3.7.3.1.1<http://book.cakephp.org/view/1017/Retrieving-Your-Data#find-first-1019> find('first') in the manual gives a perfect example. this is all happening in the controller. On Fri, Jan 21, 2011 at 1:08 PM, John L <[email protected]> wrote:
> find() is a model function. so if the model name was Post you would call it > like this: $this->Post->find() > > > On Fri, Jan 21, 2011 at 12:49 PM, OldWest <[email protected]> wrote: > >> I cannot resolve how to call a model function into a controller. I've been >> through too much documentation to count. Maybe I am wrong in what I am >> trying to do altogether? Continue to get MySQL errors. >> >> *Plan :: Model:* >> >> function getActive() >> { >> $findParameters = array( >> 'limit' => 10, >> 'order' => array('Plan.monthly_cost' => 'asc'), >> 'conditions' => array('PlanDetail.active' => 1) // Gets all >> active=1 plan_details. >> ); >> return $this->find('all', $findParameters); >> } >> >> *Plan :: Controller:* >> * >> * >> function search() { >> $this->Plan->recursive = 2; //*** Modified by Jason: Recursion needs to >> be corrected with better method. ***// >> *$active* = $this->Plan->getActive(); >> $this->set('plans', $this->paginate(*$active*)); >> } >> >> *Notice* (8) >> <http://cda-insurance.com.w3developing.com/pre/cake/beta/plans/search>: >> Array to string conversion [*ROOT....* >> >> *Warning* (512) >> <http://cda-insurance.com.w3developing.com/pre/cake/beta/plans/search>: *SQL >> Error:* 1054: Unknown column 'Plan' in 'where clause' >> >> >> -- >> 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]<cake-php%[email protected]>For >> more options, visit this group at >> http://groups.google.com/group/cake-php >> > > -- 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
