Quantcast
Channel: PHPDeveloper.org
Viewing all articles
Browse latest Browse all 10

Debuggable Blog: How to bend Cake's Model::find() method to your needs

$
0
0

New on the Debuggable blog, Tim Koschutzki has posted a method to get the fund() method in the CakePHP framework's models to bend to your will.

CakePHP allows you to use your own "find-types" for the Model::find() methodology. Those of your who are familiar with the find() method know that there are currently four types in the core: 'list', 'all', 'first' and 'count'. However, sometimes it is nice to specify your own type.

He shows an example of the end result - a find() call with a custom type that automagically gets translated correctly. His script overrides and enhances the usual find call in an extended object (extended from AppModel) that uses a switch/case statement to define the custom types and their find() search calls.


Viewing all articles
Browse latest Browse all 10

Trending Articles