Welcome, Guest
Username: Password: Remember me

TOPIC: addWhere method undefined ???

addWhere method undefined ??? 07 Sep 2016 00:22 #14508

  • koenvdz
  • koenvdz's Avatar
  • Offline
  • Junior Member
  • Posts: 24
  • Thank you received: 2
  • Karma: 0
Hi,

i am refining the results in a few of my drop down menu's with $this->addWhere statements and it always works fine but today I added a similar statement in one of the prepareQuery() function and I got this error:

Fatal error: Call to undefined method GuidemanModelJobitemsitem::addWhere() in C:\xampp\htdocs\mg\components\com_guideman\fork\models\jobitemsitem.php on line 102

I searched in other files of my project and every time I used the addWhere statement there was already an addWhere statememt present somewhere else in the file, in this one though there was no addWhere statement to be found, do I need to include another class or something?

Joomla 3.6.2
Project Guideman
Koen
Last Edit: 07 Sep 2016 00:23 by koenvdz.
The administrator has disabled public write access.

addWhere method undefined ??? 07 Sep 2016 10:31 #14510

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
This is normal.

The addWhere() function has never been available in the ITEM model.

Because the 'item' model is made by design to return only ONE element, so you cannot filter with where.
If you want to find the result using another method than the ID, you can edit prepareQuery() of your concerned model, and with a state var, to change the behavior of the search.
That's it.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: koenvdz

addWhere method undefined ??? 07 Sep 2016 16:58 #14516

  • koenvdz
  • koenvdz's Avatar
  • Offline
  • Junior Member
  • Posts: 24
  • Thank you received: 2
  • Karma: 0
Thanks again for the swift reply.

I just want to point out that I have used addWhere statements in other ITEM models before. and it worked fine. But it is OK I found a workaround that works fine for my project. ;)
Koen
The administrator has disabled public write access.
Time to create page: 0.104 seconds

Get Started