yeah the problem got solved. I was making a basic error.

Thanks for support  :)

*With Best Regards,
Mohit Kumar <http://kumarmohit.com>*
*+91-9582894570*



On Mon, Aug 20, 2012 at 10:08 AM, Bharat Maheshwari <
[email protected]> wrote:

> As you use all in $current_roster = $this->Weeklyroster->find('**all',
> array('conditions' => array('Weeklyroster.week' => $id))); so it is
> creating following structure :-
>
> array(
>     [0]
>          array(
>                           ['Weeklyroster']
>                                         array(
>                                                  ['field_name1']
>                                                  ['field_name2']
>                                                  )
>                   )
>     )
>
> You have to use foreach loop to print data or if you have only one row
> from database please use first besides all
>
>
> On Monday, August 13, 2012 9:09:37 PM UTC+5:30, 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.


Reply via email to