Thursday, August 15, 2013

Cake 1.3: Using translate behaviour and find('list') returns wrong name

Hi,

I am using the translate behaviour in my models and so far it worked well. However, one issue I can't get fixed and I am not sure if this is me or cake. If I use a find('all') on my model everything works fine - however, if I use a find('list'), the result is [id]=>id (e.g. [22]=>22. Everything worked fine (and as expected) before I implemented the translate behaviour.

I did two debugs right after each other to show what I mean:


$categories=$this->Category->find('list', 
array(
'conditions' => array(
'Category.parent_id' => $id,
'Category.active' => 1
)
)
);
debug($categories);

returns

Array
(
    [22] => 22
)
 
while the same query with 'all'
 
$categories=$this->Category->find('all', 
array(
'conditions' => array(
'Category.parent_id' => $id,
'Category.active' => 1
)
)
);   

returns:

customerweb_test/controllers/categories_controller.php (line 160) 
Array
(
    [0] => Array
        (
            [Category] => Array
                (
                    [id] => 22
                    [parent_id] => 1
                    [active] => 1
                    [created] => 2011-11-03 21:31:16
                    [modified] => 2013-08-15 00:23:48
                    [locale] => eng
                    [name] => Dummies with Engraving
                    [description] => 
                    [detailed_description] => 
                )

        )
)

Any ideas how to fix this?

Thanks a lot,
Christian

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate