Of course I know how to do it whithout the extract method. The point is, if the extract is not always working, it's not really usable cause you never know when it will break your things
Someone points me to this ticket which could be related http://cakephp.lighthouseapp.com/projects/42648/tickets/104-testpatch-setextract-returns-wrong-result-key-when-there-are-two-arrays-at-the-same-level But anyway, this fix would probably not be coming soon Seems like I'll need to rewrite large parts of code... ugh On 2 mai, 19:51, Otavio Martins Salomao <[email protected]> wrote: > u try this! > foreach($test as $element) > $result = $element['Deep1']['Deep2']['extract']; > > 2011/5/2 Gluckens <[email protected]> > > > > > > > > > Hi everyone, > > > I'm trying to extract data from an array containing only one element > > and it doesn't seem to work properly. > > Here's an example : > > > Starting array > > $test = array(4 => array('Deep1' => array('data1' => 'nothing', > > 'Deep2' => array('extract' => 1)))); > > Array > > ( > > [4] => Array > > ( > > [Deep1] => Array > > ( > > [data1] => nothing > > [Deep2] => Array > > ( > > [extract] => 1 > > ) > > ) > > ) > > ) > > > Set::extract('/Deep1/Deep2[extract=1]', $test); > > NOT CORRECT > > Array > > ( > > ) > > > But, when I add another element, let's say > > $test[12] = array(); > > It works fine > > Set::extract('/Deep1/Deep2[extract=1]', $test); > > CORRECT > > Array > > ( > > [0] => Array > > ( > > [Deep2] => Array > > ( > > [extract] => 1 > > ) > > ) > > ) > > > Am I using it properly? > > Thanks in advance for any help. > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > [email protected] For more options, visit this group > > athttp://groups.google.com/group/cake-php -- 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 with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
