Get the related entry from an Entries field in a Matrix block within a plugin craft 3 So I've got this which accurately gives me the desired relation block within my matrix, but how do I actually get the Entry object from a relation field?

$project = Entry::find()-&gt;id($projectId)-&gt;one();

foreach ($project-&gt;location as $locations) {
        if ($locations-&gt;getType()-&gt;name === 'Locations') {
            // Grab a building from the block. 
            // Right now this just returns the relation table ID, I'd like the actual Entry object with it's attributes.
            $buildings = $locations-&gt;buildings;
        }

    }
figured this one out on my own, so to get all of the related objects, I just needed to change the above query to $buildings = $location-&gt;buildings-&gt;all();