Hi Eleazar.

http://book.cakephp.org/view/75/Saving-Your-Data is probably your best
bet. I had to read it a couple of times until it made sense.

Have you setup your models correctly? ie the User.php should have:
var $hasMany=array('Login');
and the Login.php should have
var $hasMany=array('User');

if you're trying saveAll from the user without the $hasMany, cake
won't find the association.

The next thing is to make sure your data array is setup correctly.

On Feb 23, 6:36 pm, Eleazar <gerrit.kru...@gmail.com> wrote:
> Hi all,
> I'm really not sure if I did something wrong but I couldnt get saveAll
> to work on a BelongsTo model.
>
> I have a login table with different types of users, and I have
> different tables for each type of user connected with the login table.
> So for example the `user` table belongs to the login table and has a
> foreign key (login_id) referencing it.
>
> I could not get a successfull saveAll to work. The validation worked
> fine but after successful validation, the save failed.
>
> I used the manual workaround by first saving the login details and
> then copying the login_id to the user  table, but I still think the
> saveAll should be able to do this by itself. I traced the fail to a
> __save function that saveAll uses. If I understood it correctly, the
> save failed because the foreign key login_id was missing. Why couldn't
> it figure out what the id was or does it sound like I either tried
> something that's not supported, or I did something wrong?
>
> Thanks for your time.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to