thx jules...i thnk i got it...
i had to make saveAll after each
$this->data['LinkAdditionalInformation']['title']= $this -> Session -
> read('abc.contact.phone_title1');
$this->data['LinkAdditionalInformation']['content']= $this -> Session
-> read('abc.contact.phone_number1');
now it works...
On 19 Aug., 21:35, Jules <[email protected]> wrote:
> You're overwriting previous values so the last one will be the only
> one saved. Try:
>
> $this->data['LinkAdditionalInformation'][] = array(
> 'title' => $this->Session->read('abc.contact.phone_title1'),
> 'content' => $this->Session->read('abc.contact.phone_number1')
> );
>
> $this->data['LinkAdditionalInformation'][] = array(
> 'title' => $this->Session->read('abc.contact.phone_title2'),
> 'content' => $this->Session->read('abc.contact.phone_number2')
> );
>
> $this->data['LinkAdditionalInformation'][] = array(
> 'title' => $this->Session->read('abc.contact.phone_title3'),
> 'content' => $this->Session->read('abc.contact.phone_number3')
> );
>
> If saving in model other than LinkAdditionalInformation then you'll
> need saveall.
>
> This should work.
>
> On Aug 19, 7:55 pm, Tomfox Wiranata <[email protected]> wrote:
>
> > hi
>
> > i am having problems with hasMany saving.
>
> > i have 1-3 records to save in a table. in my controller, before the
> > save action i tell cake what to save:
>
> > $this->data['LinkAdditionalInformation']['title']= $this -> Session ->
> > read('abc.contact.phone_title1');
>
> > $this->data['LinkAdditionalInformation']['content']= $this -> Session
> > -> read('abc.contact.phone_number1');
>
> > $this->data['LinkAdditionalInformation']['title']= $this -> Session ->
> > read('abc.contact.phone_title2');
>
> > $this->data['LinkAdditionalInformation']['content']= $this -> Session
> > -> read('abc.contact.phone_number2');
>
> > $this->data['LinkAdditionalInformation']['title']= $this -> Session ->
> > read('abc.contact.phone_title3);
>
> > $this->data['LinkAdditionalInformation']['content']= $this -> Session
> > -> read('abc.contact.phone_number3');
>
> > so basically i want to save 3 phone numbers in a table. now what
> > happens, is that only one number is saved.
>
> > i declared the relation correct in my model:
>
> > model abc
> > var $hasMany = 'LinkAdditionalInformation';
>
> > if i use saveall cakes saves only 2, not all 3. the abc table gets
> > filled correct. its just my LinkAdditionalInformation table that is
> > messed up
>
> > can u help me? thanx a lot :)
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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en