piątek, 16 września 2011

czwartek, 7 lipca 2011


if you ever happen to encounter problems with acl check if you created your own beforeFilter. If yes make sure all you controllers' beforeFilter calls parent::beforeFilter

poniedziałek, 23 maja 2011

loading models

One particular answer from stockoverflow which i found useful and comperhensive:
orginal post
App::import() only finds and require()s the file and you'll need to instantiate the class to use it. You can tell import() the type of class, the name and file path details.
ClassRegistry::init() loads the file, adds the instance to the object map and returns the instance. This is the better way to load something because it sets up 'Cake' things as would happen if you loaded the class through normal means. You can also set an alias for the class name which I've found useful.
Controller::loadModel() uses ClassRegistry::init() as well as adds the Model as a property of the controller. It also allows $persistModel for model caching on future requests. This only works in a Controller and, if that's your situation, I'd use this method before the others.

wtorek, 15 marca 2011

Plugin models

i had problems with Containable error Model "XXX" is not associated with model "YYY"
it was during accessing deep associacion in a plugin.
The error was there because cake's bake doesn't prepend className field in models associacions table like $hasMany or $belongsTo

I think some of you might get caught by this bug.