Are these models loaded? On Wed, Jan 21, 2009 at 6:10 PM, Yusuf Widiyatmono <[email protected]> wrote: > i did and it still shows me same errors... > > > ________________________________ > From: brian <[email protected]> > To: [email protected] > Sent: Thursday, January 22, 2009 2:49:31 AM > Subject: Re: Dynamic Model Call > > > Try $this->AreaInfo->{$model_name}->find(...) > > On Wed, Jan 21, 2009 at 12:33 AM, wmonou <[email protected]> wrote: >> >> Helo there i am trying to call model from a variable >> >> let say that i have a code is like this: >> >> // $model_name is a string >> // bind necessary model >> if(!empty($model_name)){ >> $this->AreaInfo->bindModel( >> array( >> 'belongsTo'=>array( >> $model_name => array( >> 'className' => $model_name, >> 'foreignKey' => >> 'reference_id' >> ) >> ) >> ) >> ); >> } >> >> $model_data = $this->AreaInfo->$model_name->find('list'); // ** >> this is my question >> print_r($model_data); >> >> the $model_data variable now is not empty, but i got something like >> this : >> >> Array >> ( >> [1] => 1 >> [2] => 2 >> [3] => 3 >> [4] => 4 >> [5] => 5 >> [6] => 6 >> [7] => 7 >> [8] => 8 >> [9] => 9 >> [10] => 10 >> [11] => 11 >> [12] => 12 >> [13] => 13 >> [14] => 14 >> [15] => 15 >> [16] => 16 >> [17] => 17 >> [18] => 18 >> [19] => 19 >> [20] => 20 >> ) >> >> Fatal error: Cannot access empty property in {some_directories_path} >> \app\controllers\areas_controller.php on line ** >> >> is it possible to do such a thing like above? if yes or no please let >> me know with your sugesstion :) ... >> >> > >> > > > > >
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
