I am trying to figure out how to return asset field(s) in a PHP entry query. Also if I could learn how to return "custom fields" when returning an Object that would be great too! Right now I am having to specify
asArray() to even get access to most of my "custom fields"
As as example: I have a Vehicle Entry which has a custom field with the handle of price (number field) and another custom field (asset field) with the handle of images. When I execute the query without specifying the asArray() param I cannot find the custom fields included in the results. But if I specify asArray() then they are all there with the exception of my images field which I think is because it is an asset field or possible because it can be a collection of images? How can I make sure all the fields tied to an entry are returned in my query?
Here are some examples of queries and the corresponding results:
PHP Query without asArray():
$entry_query = Entry::find() ->section('inventory') ->all();
PHP Query results with asArray():
$entry_query = Entry::find() ->section('inventory') ->asArray();
However even when specifing to make the result set an array I still cannot figure out how to include the 'images' field.
I am having a difficult time finding an answer via the documentation or an example of someone doing the same. All the examples i find are for the template side in twig.