How to include asset fields in query in php?
You can skip the asArray() part, as the object has all you need:

// This bit returns only the query that defines what objects to get
$entryQuery = Entry::find()-&gt;section('inventory');

/*
 * This will get you one object, based on the query. 
 * Use all() if you want an array of objects
 */
$entry = $entryQuery-&gt;one();

// Of course, this could be written as
$entry = Entry::find()-&gt;section('inventory')-&gt;one();

/* 
 * Thanks to Yii2's magic getters and setters, 
 * and the way Craft uses them, any custom field can be 
 * obtained by using the field's handle:
 */
$customFieldContent = $entry-&gt;customFieldHandle;

/*
 * If the custom field is any kind of relation field (assets, categories, tags ...),
 * this custom field attribute would return a new query object.
 * You'd need to call all() or one() again to get the actual related objects:
 */
 $images = $entry-&gt;customImagesFieldHandle-&gt;all();

/*
 * To improve performance, you can eager load the images:
 */
$entry = Entry::find()
    -&gt;section('inventory')
    -&gt;with(['customImagesFieldHandle'])
    -&gt;one();

/*
 * ... which would result in an array of images as the value of the
 * customImagesFieldHandle attribute
 */
$images = $entry-&gt;customImagesFieldHandle;


Some light reading:

About entry queries

About eager loading

Addition, after seeing exactly what it is you want. Use Craft's (or actually Yii's) ArrayHelper map() function to loop through your entries and mapping entry content to what you want:

use craft\helpers\ArrayHelper

// Use the map() function to do what you want
$entries = Entry::find()-&gt;section('inventory')-&gt;all();

$entriesAsYouWantThem = ArrayHelper::map($entries, 'id', function($entry) {
    return (object)[
        'images' =&gt; $entry-&gt;images-&gt;all(), // or without all, if you use -&gt;with()
        'price' =&gt; $entry-&gt;price,
        'year' =&gt; $entry-&gt;year,
        ... All other fields
    ];
});