Wednesday, February 25, 2015

AppModel Subclass Constructor not called

I have a model that extends AppModel and overrides the constructor, but the constructor never gets called... instead only the AppModel constructor is called.  

As a result, the belongTo and other associations defined in the class are empty.  However, if I add the following LINE before calling "find", the Model has the defined belongsTo associations and works without error.

 if ( empty($this->ctl->LocationPackage->belongsTo) ) die('LocationPackage Model is corrupted');

Does anyone have any suggestions as to why the above LINE causes the Model to be constructed from the Subclass rather than only call the AppModel constructor?

Thanks in advance.


Sincerely,

Charles

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: