0

I've got a bit of a complicated array that I'm working with and I'm not sure how to retrieve one of the values in the array. The array structure is as below and I'm trying to get the 'value'.

array ( 
  0 => Drupal\search_api\Query\Condition::__set_state(
    array( 
      'field' => 'title', 
      'value' => 'hello', 
      'operator' => 'CONTAINS', 
    )
  ), 
  )

I tried using $array[0]['value'] but it returns NULL.

Any ideas on how to go about this one?

0

1 Answer 1

1

The Drupal\search_api\Query\Condition::__set_state there is how var_export tells you that there is an object in $array[0]. The array shown inside that is a view of the internal data of that object, which may not be directly accessible at all.

You need to find the documentation or source code for the Drupal\search_api\Query\Condition class and see how it provides access to its data. For instance, the access might look like this (it probably doesn't, this is an example not a suggestion):

echo $array[0]->tellMeTheValue();
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, you're right from the documentation I can see that the access is $array[0]->getValue()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.