Re: saveAll with a hasMany relationship

2011-07-08 Thread ianemv
.n5.nabble.com/saveAll-with-a-hasMany-relationship-tp1328838p4564408.html Sent from the CakePHP mailing list archive at Nabble.com. -- 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

Re: saveAll with a hasMany relationship

2009-08-27 Thread Nancy
I think maybe the difference between what you and I was doing is that I was trying to save multiple main records at one time, whereas you were doing one. $this-data[1]['Recipe']['name'] = 'Delicious apple pie'; $this-data[1]['Recipe']['serves'] = 6; $this-data[1]['Recipe']['valid'] = 1;

Re: saveAll with a hasMany relationship

2009-08-27 Thread Nancy
Ok, just caught something in the cakephp online docs: saveAll(array $data = null, array $options = array()) Used to save (a) multiple individual records for a single model or (b) this record, as well as all associated records So perhaps this means I'm just trying to do something that isn't

Re: saveAll with a hasMany relationship

2009-08-24 Thread Luke
Hi Nancy, I have a setup where I save the hasMany and HABTM in 1 go. It was a bit tricky and took me aswell, I think 3 weeks (shame) to finally get it sorted when I got the hint with the array setup. It really is all about having the $this-data set up in the right way. I suppose you have a form

Re: saveAll with a hasMany relationship

2009-08-22 Thread Nancy
Yeah, this is essentially what I had to end up doing. I wanted to save a bunch of records at once and it worked great until I added the hasOne/hasMany relationship. So I had to stop saving them all at once and do one at a time. But at least it saves the associated data at the same time as it

Re: saveAll with a hasMany relationship

2009-08-22 Thread Nancy
Here's the structure I ended up having to go with $save['Constoptvalue']['device_id'] = 16; $save['Constoptvalue']['constopt_id'] = 1; $save['Constoptvalue']['valid'] = 1; $save['Compoundchainlist']['name'] = 'poohbear'; $save['Layer'][0]['layer_id']=4;

Re: saveAll with a hasMany relationship

2009-08-21 Thread Luke
Hi Nancy, I had the same issue like you are describing, how to save the hasMany after positing it on here, I found the solution. I have a recipe hasMany Ingredient relationship, the importance is to have the array formated in the right way. It needs to look like below, than it will work.

saveAll with a hasMany relationship

2009-08-19 Thread Nancy
I was so happy. I finally figured out how to make saveAll work with my HABTM relationship so I figured adding a hasMany would be a piece of cake. I have a little practice data structure set up to test it out. $save[1]['Constoptvalue']['device_id'] = 16;

Re: saveAll with a hasMany relationship

2009-08-19 Thread Nancy
I just wanted to add, I'm saving multiple records at a time. So $this- data might have an index going up to 5 or so with models for 3 or more different things. I did manage to get a hasMany to work, but not with multiple records. $save['Firstname']['firstname']='Margarie';