Hi Jose,
Yes , I did the controller, model and view creation through the bake 
console. But it is not helping me to save data from single form to multiple 
tables. In my case the vendor signup form is having the input  fields to 
vendor table, vendor manager table and a user table. Would you please help 
me to find a solution on this?

Regards,
Jipson

On Monday, 4 August 2014 18:26:48 UTC+1, José Lorenzo wrote:
>
> I would recommend that you use the bake console tool to create the initial 
> controller code and forms, that way I'm sure you will learn and understand 
> how forms should be structured.
>
> On Monday, August 4, 2014 5:46:29 PM UTC+2, Jipson Thomas wrote:
>>
>> Hi,
>> When I change the controller code as follows, It saves in vendor table 
>> only and return a true value.
>>
>> $vendors = TableRegistry::get('Vendors');
>>         
>>         if ($this->request->is('post')) {
>>             $vendor = new Vendor($this->request->data['Vendor']);
>>             $vendor->VendorManagers = [
>>                 new VendorManager($this->request->data['VendorManager']),
>>             ];
>>             $vendor->Users = [
>>                 new User($this->request->data['User']),
>>             ];
>>             //print_r($vendor);
>>             if ($vendors->save($vendor)) {
>>                 $this->Flash->success(__('The vendor has been saved'));
>>                 return $this->redirect(['action' => 'index']);
>>             }
>>             $this->Flash->error(__('Unable to add the vendor'));
>>         }
>>         $this->set('vendor', $vendor);
>>         $this->set('subscription_package', $id);
>>         $this->set('subscription_type', $payoption);
>>
>> On Monday, 4 August 2014 16:17:10 UTC+1, Jipson Thomas wrote:
>>>
>>> The save method is returning a false only not any error messages.
>>>
>>> On Monday, 4 August 2014 14:43:20 UTC+1, Jipson Thomas wrote:
>>>>
>>>> Hi All,
>>>> Would you please give me some details or samples of saving data from a 
>>>> single form to the tables main and has many relationships. I tries with 
>>>> the 
>>>> normal way by adding a modelname.fieldname on form and the sual newentity 
>>>> of main table but it through false on save(); Please help me to fix this
>>>>
>>>> Regards,
>>>> Jipson
>>>>
>>>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to