you may have to modify that a bit to fit your data structure, i did
not fully analyze your example

On Sep 15, 2:19 pm, "j.blotus" <[email protected]> wrote:
> foreach ($tmp_attachment as $key => $value) {
>      $this->data['LinkAttachment'][$key]['filetype'] = $value;
>
> }
>
> that should give you a numeric indexed array that conforms with the
> spec in the api:http://book.cakephp.org/view/75/Saving-Your-Data
> saveAll
>
> hope that helps
>
> That would give you a numeric indexed array for saving, but since I
> dont'
>
> On Sep 15, 2:07 pm, Tomfox Wiranata <[email protected]> wrote:
>
>
>
> > huh, that makes sense :)
>
> > this is the array
>
> > Array (
> >  [0] => Array ( [LinkTmp] => Array ( [id] => 695 [link_id] => 0 [eyed]
> > => 111 [title] => [name] => Gehalt.xslsx [path] => ../link/111/
> > Gehalt.xlsx [filetype] => xlsx [size] => 22528 [flyer_big] =>
> > [flyer_thumb] => [qr] => [attachment] => 1 [created] => 2010-09-15
> > 19:44:53 ) )
>
> >  [1] => Array ( [LinkTmp] => Array ( [id] => 699 [link_id] => 0 [eyed]
> > => 111 [title] => [name] => Meeting 18082010.ppt [path] => ../link/
> > 111/
> > WITA Meeting 18082010.ppt [filetype] => ppt [size] => 152576
> > [flyer_big] => [flyer_thumb] => [qr] => [attachment] => 1 [created] =>
> > 2010-09-15 19:47:38 ) ) )
> > x :)
>
> > any suggestions how to code related to this structure? i guess it has
> > to look sth like this?
>
> >  $this->data['LinkAttachment']['filetype'] = $tmp_attachment['0']
> > ['LinkTmp']['filetype'];
>
> > except that I need a counter. If there are 4 results, I need 0-3 as
> > index..
>
> > qucik ideas?
>
> > thx :)
>
> > On 15 Sep., 19:13, "j.blotus" <[email protected]> wrote:
>
> > > When you do find 'all', it returns the array in a numeric index, when
> > > you do find 'first' it returns a single item with no numeric index.
> > > When you omit parameters, I believe it defaults to 'first'.
>
> > > So the answer is you need to look at how the array you are trying to
> > > work with is formatted.
>
> > > print_r($tmp_attachment);
>
> > > Missing index is the most basic of errors, it just tells you the index
> > > you are looking for doesn't exist.
>
> > > On Sep 15, 12:55 pm, Tomfox Wiranata <[email protected]>
> > > wrote:
>
> > > > as soon as I abandon the 'all' paramter in my find() function, cake
> > > > stops throwing this error.
>
> > > > but i need 'all' because i am expecting multiple entries
>
> > > > On 15 Sep., 18:50, Tomfox Wiranata <[email protected]> wrote:
>
> > > > > hi.
>
> > > > > I have two Models LinkTmp and LinkAttachment, hence two tables. these
> > > > > two models have no relation at all, since the LinkTmp is just for
> > > > > temporary storing, till the User finally saves his product.
>
> > > > > I want to save data from LinkTmp in LinkAttachment. Its nothing else
> > > > > than copying the data from the temp table to the real target. So first
> > > > > i get all the data from LinkTmp I need:
>
> > > > > $tmp_attachment = $this->LinkTmp->find('all', array('LinkTmp.abc =' =>
> > > > > $this -> Session -> read('Link.abc'), 'LinkTmp.attachment' => '1'));
>
> > > > > the result is multiple results. I checked. now i need to save these
> > > > > results in LinkAttachment:
>
> > > > >  $this->data['LinkAttachment']['filesize'] = 
> > > > > $tmp_attachment['LinkTmp']
> > > > > ['size'];
> > > > >  $this->data['LinkAttachment']['filetype'] = 
> > > > > $tmp_attachment['LinkTmp']
> > > > > ['filetype'];
> > > > >  $this->LinkAttachment->saveAll($this->data);
>
> > > > > now cake throws
>
> > > > > Notice (8): Undefined index: LinkTmp
>
> > > > > how is that possible? I used this model before in my view the same
> > > > > way, just with pure find() and no 'all'...
>
> > > > > thanks !!

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

Reply via email to