sobota, 24 listopada 2012

Time for Symfony2

Since i really lost track with changes in CakePHP i've decided to use Symfony2 for my new project.

As i'm using shared hosting (bluehost) I had difficulties getting things configured.
First of all:
By default i had php.ini value register_argc_argv set to Off which resulted in errors when trying to run php app/console

Second error: Use of undefined constant STDIN line 40.
What i found was that calling php in linux console was calling cgi-fcgi instead of cli client so check your php -v and find path to cli version of php.

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.