Sunday, July 24, 2011

Re: Saving Related Models

The model relation that I need is User hasOne Profile. So, could I do
this to save the user and the profile at the same time:

echo $form->create('User', array('action'=>'add'));
echo $form->input('User.username', array('label'=>'Username:'));
echo $form->input('User.password');
echo $form->input('Profile.first_name', array('label'=>'Profile'));
echo $form->input('Profile.last_name');
echo $form->input('Profile.email');

Thanks.


On Jul 22, 5:40 pm, Jens Dittrich <jdittr...@gmail.com> wrote:
> Because Company hasMany Account... the example implies that you want to save
> the first Account along with the new entry of a company.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: