Saturday, June 27, 2009

Re: Two models how to access in one controller

Thanks its working now

On Jun 27, 2:19 pm, Vijay Kumbhar <k.vidn...@gmail.com> wrote:
> Hello rajasekaran,
>
> Please check the model names in the $uses.
> You have made a mistake in the model name of "Employees" it has to be
> "Employee".
> If you have any other error please post it here for more help.
>
> On Fri, Jun 26, 2009 at 9:52 PM, harish rajasekaran <
>
>
>
> harish.rsn.av...@gmail.com> wrote:
>
> > Hi i am using two model and i want to access that models in one
> > controller how can i use please help see my below code
>
> > class EmployeesController extends AppController {
> > var $name = 'Employees';
> > var $helpers = array('Html', 'Form');
> > function register()
> > {       //code
>
> > if (!empty($this->data)) {
>
> > $storeVal = $this->data['Employee']['email_id'];
> > $checkQuery  = $this->Employee->find('all', array('conditions' =>
> > array('Employee.email_id' => $storeVal)));
> > //echo sizeof($checkQuery);
> > if(sizeof($checkQuery)==0){
> > $this->Employee->create();
>
> > if ($this->Employee->save($this->data)) {
> > $this->Employeelogin->create();
> > if($this->Employeelogin->save($this->data))
> > $this->Session->setFlash('The Task has been saved');
> > $this->redirect(array('action'=>'index'), null, true);
> > } else {
> > $this->Session->setFlash('Task not saved. Try again.');
> > }
> > }
> > else
> > $this->Session->setFlash('E-mail id already exists');
> > }
>
> > }
> > }
>
> > if i use var $uses = array('Employees','Employeelogin'); it gives
> > error please help hoe to solve this problem
>
> --
> Thanks & Regards,
> Vijayk.
>
> "You Bring the Dreams, We'll Bring the Means"
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: