Provide access to a model from a Component
Say you have a model called FoosFum in a file called foos_fum.php
loadModel('FoosFum');
$this->FoosFum = &new FoosFum();
Limit the size of your controller
If you only use a model in certain circumstances do not use the $uses array, use loadModel where you need it.
References:
http://manual.cakephp.org/chapter/controllers
Google Group
http://manual.cakephp.org/chapter/components
Advertisement
Jan 22, 2008 at 6:37 am |
Hi!
I was searching for this all the google!…
You have saved my life!
Thanks in advance!
Feb 7, 2008 at 4:24 am |
Hi I have getting error that
Fatal error: Class ‘Object’ not found in C:\xampp\htdocs\sock\cake\libs\model\datasources\datasource.php on line 37
while using loadModel function. Could u please guide me how to solve this.I am testing my model. FOr this I required this functionality.
Reagards,
Feb 12, 2008 at 4:34 pm |
Jahangir,
This sounds like a configuration issue or something. Try the Google Group or CakePHP website for a solution… Sorry, I don’t have any ideas.