1

so currently I have a script where running

$obj = $this->search()->browse()->params($aBrowseParams);

returns the following data to $obj

Phpfox_Search_Browse Object
(
    [_iCnt:Phpfox_Search_Browse:private] => 2


    [_aParams:Phpfox_Search_Browse:private] => Array
        (
            [module_id] => music.song
            [alias] => m
            [field] => song_id
            [table] => phpfox_music_song
            [hide_view] => Array
                (
                    [0] => pending
                    [1] => my
                )

            [service] => music.song.browse
        )

    [_oBrowse:Phpfox_Search_Browse:private] => Music_Service_Song_Browse Object
        (
            [_sTable:protected] => 
        )

    [_sView:Phpfox_Search_Browse:private] => 
    [_aConditions] => Array
        (
            [0] => AND ( (m.title LIKE '%test%') )
            [1] => AND m.view_id = 0 AND m.privacy IN(0)
            [2] => AND m.item_id = 0
        )

)

I'm attempting to get the following value

AND ( (m.title LIKE '%test%') )

Now I've tried converting it to an array using

$arr= (array) $obj;

then simply getting the value by specifying

$obj['value']['value'] 

but it's not working, how should I retrieve the value?

1
  • 1
    I think there should be methods for accessing properties of object in phpFox. Commented Aug 5, 2013 at 19:20

1 Answer 1

1

What about:

$value = $obj->_aConditions[0];

This should work as long as _aConditions is a public array in the object.

Sign up to request clarification or add additional context in comments.

7 Comments

Terrible naming if _aConditions is public. Generally anything that starts with _ should be private/protected.
It looks like it may be public judging by the output he posted.
Oh, I agree. In the object above it is public. I just meant in general methods/properties that start with an underscore are not public.
aConditions is indeed public, infact it is not even declared as a property. phpwolfcamp.com/phpFoxDocuments/html/…
That would be inaccessible without some kind of method to get it for you... i.e. $conditions = $obj->getConditions()
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.