Monday, December 9, 2013

Certain models via $uses cause non-object errors in Controller


I need to include a couple of models in various controllers. However, when I try to put the models in $uses() they invariably throw non-object errors even when not being called, and even when the model is totally empty. 

However, ONE model ("User") will play nice. 

There are no relationships between any of these models. 

For example, in the Item Model/Controller:

$uses = array("User")

Does not throw any sort of errors and the pages behave normally.

However: 

$uses = array("Trinket");

Throws a non-object error, even when Trinket is not being used and I'm using the Item model. Even if I completely empty Trinket I still get a non object error. Every other model causes this error EXCEPT User, but if I use a duplicate of User and just rename it Trinket, Novel, Candy, whatever, it throws the error. There is nothing special about User except its name that I can see. 

What am I missing? 

--
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/groups/opt_out.

No comments: