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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.