Model::findAll() only indexes fields that are present in the database;
anything else is returned as you see (numeric index).

You can write an afterFind() callback in your model to insert the
fields into the correct positions.

On Oct 19, 11:15 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hey,
>
> I am trying to do this:
> $this->set('announcements', $this->Announcement->findAll(null,
> array('id', 'name','SUBSTRING_INDEX("content", " ", 20) AS teaser',
> 'pic_filename'), 'add_date DESC'));
>
> and it doesn't work properly ..
>
> here is part of the dump of the resulting object:
> array(2) {
>     ["Announcement"]=>
>     array(3) {
>       ["id"]=>
>       string(1) "2"
>       ["name"]=>
>       string(18) "Stire senzationala"
>       ["pic_filename"]=>
>       string(8) "nicu.jpg"
>     }
>     [0]=>
>     array(1) {
>       ["teaser"]=>
>       string(7) "content"
>     }
>   }
>
> Any help would be apreciated!
>
> Thx


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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