CakePHP
- October 10, 2008
CakePHP - the right syntax to use near ‘generateList’
If you have been using the cakePHP 1.2 beta’s scarfold to bake (generate) your controller, when you go to the add article page, there will be an error message like the one below:
Warning (512): SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘generateList’ at line 1 [CORE/cake/libs/model/datasources/dbo_source.php, line 512]
If this happens to you, then that means your cake baked the wrong version of CRUD code for you, to fix the problem, you first locate the controller file, my controller’s name is posts, so my controller file is located at: cake/app/controllers/posts_controller.php.
Looking for the code:
generateList();
It may appear more than once in your code, replace it with:
find('list');
Since CakePHP 1.2, the CakePHP 1.1 syntax generateList(); has been replaced by the powerful find(”).
Hope this helps! :)











































11 Responses to “CakePHP - the right syntax to use near ‘generateList’”
Incredible!
I didn’t think that there was a solution I could find.
How are you with zend eclipse?
I can debug php scripts ok, but it chokes when I try to debug a controller with:
class ‘controller’ not found
If you don’t know the answer, I would sure appreciate a lead.
Thanks again,
Bill Goss
By Bill Goss on Oct 21, 2008
Hi, Bill
I am glad this post helps :)
I am not so familiar with eclipse.
cakephp has very bad error report, i also always receive: class ‘controller’ not found. The error message doesn’t make much sense, normally I will just have to dig into the cake or check the log for answer, hope this helps :)
By admin on Nov 25, 2008
Thanks.
Its really helpful
By Fahad on Nov 28, 2008
thanks !
By nb on Dec 8, 2008
thanks for this - really helpful
By pfwd on Feb 12, 2009
One more…
THANKS a lot!
By Ghost on Feb 26, 2009
I need to say it, THANKS A LOT :)
By Sami Andoni on Mar 13, 2009
All at once now…
THANK YOU!!!!!!!
Your fix is the first in Google’s search for that SQL error.
By Pat M on Mar 20, 2009
Great !!!!! , Thanks for sharing the solution. It saves lot of time. Thank u very much.
By Navaneeth on May 6, 2009
Thank you very much!!!!!!
By shandercage on May 10, 2009
replace generateList(), for find(’list’).
Ole! Very easy!
By shandercage on May 10, 2009