PS Apologies, to clarify the error happens even with just the call to ClassRegistry::init()
On Nov 4, 4:44 pm, toby1kenobi <[email protected]> wrote: > Hi there, > > I'm using CakePHP 2, and in the afterFind callback of one model I > conditionally want to retrieve data from another. The two models > aren't associated. In the first model, when certain conditions are > met, I'm trying to do something along the lines of: > > $model2 = ClassRegistry::init('Model2'); > $data = $model2->find('all'); > > This keeps giving me a fatal PHP error, like: > > Fatal error: Cannot redeclare class Model2 in C:\Users\Me\Documents > \Projects\my_project\app\Model\Model2.php on line 114 > > From the call stack it looks like this arises as a result of > Model->_constructLinkedModel( ) being called after the as a result of the > > $model2->find('all') > > Should this work, or am I wrong to even try? Any help would be much > appreciated. > > Cheers, > > Toby -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
