array with numeric keys 0, 1, 2, ... - but not an associative array
with keys "some", "thing", ... or 4, 2, 15, ...
If you call it as Set::extract("/Some/thing", array_values($data))
when $data is associative array it will pass.
On 3 май, 16:21, Gluckens <danny30...@gmail.com> wrote:
> 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 relatedhttp://cakephp.lighthouseapp.com/projects/42648/tickets/104-testpatch...
>
> 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 <otaviosalo...@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > u try this!
> > foreach($test as $element)
> > $result = $element['Deep1']['Deep2']['extract'];
>
> > 2011/5/2 Gluckens <danny30...@gmail.com>
>
> > > 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.organdhelp
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscribe@googlegroups.com 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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment