I tried that also using a for each. still having some problems with it. *With Best Regards, Mohit Kumar <http://kumarmohit.com>* *+91-9582894570*
On Tue, Aug 14, 2012 at 7:39 PM, Dave M. <mil...@gmail.com> wrote: > I suggest you throw a debug($weeklyroster) into your view to see how the > array is actually structured. I would assume that you would want > $weeklyroster[0]['Weeklyroster']** > ['week'], $weeklyroster[1]['Weeklyroster']**['week'], etc. > > On Monday, August 13, 2012 11:39:37 AM UTC-4, mohit wrote: >> >> Hi Folks, >> >> I am having a strange error. I don't know what I am doing wrong. >> I am using following code in my weeklyrostercontroller.php file >> >> var $uses = array('Weeklyroster','Shift'); >>> >> >> I have created a function to generate the roster. >> >> >> public function generate($id = null) { >>> $this->Weeklyroster->week= $id; >>> //if (!$this->Weeklyroster->exists(**)) { >>> //throw new NotFoundException(__('Invalid weeklyroster')); >>> // } >>> //$this->set('weeklyroster', $this->Weeklyroster->read('**week', >>> $id)); >>> $current_roster = $this->Weeklyroster->find('**all', >>> array('conditions' => array('Weeklyroster.week' => $id))); >>> foreach ($current_roster as $current_rosters) { >>> $vid=$current_rosters['**Weeklyroster']['id']; >>> >>> $current_shifts = >>> $this->Weeklyroster->Shift->**find('all',array('conditions' >>> => array('Shift.id' => $vid))); >>> >>> >>> } >>> >>> >>> $this->set('weeklyroster', $current_roster); >>> $this->set('current_shifts',$**current_shifts); >>> >>> } >>> } >> >> >> if a use following code ($weeklyroster['Weeklyroster']**['week'] in my >> view file , I get the following error. >> >> *Notice* (8): Undefined index: Weeklyroster >> [*APP\View\Weeklyrosters\generate.ctp*, line *3*] >> >> Please suggest >> >> >> >> *With Best Regards, >> Mohit Kumar <http://kumarmohit.com>* >> *+91-9582894570* >> >> -- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en-US. > > > -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.