Wednesday, January 27, 2016

Hash::get() & Hash::extract()

Hi,

I am a noob at CakePHP. I have the following array:

$fooArray = Array
(
    [0] => Array
        (
            [Foo] => Array
                (
                    [foo_id] => 100
                    [foo_role_id] => 10
                )

        )

)

I looked at the Hash::get() & Hash::extract() methods. I would like to extract the value of 'foo_id' where 'foo_role_id' is 10.

I was using the below statement but it doesn't work:
Hash::extract($fooArray, '{n}.Foo[foo_role_id = 10].foo_id');


Please help me correct the above statement.

Thanks!

--
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: