Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Fully Hydrated join

I'm having trouble hydrating my result from the database. I run the following

$tags = $this->modelsManager->executeQuery("
            SELECT namespace.*, predicate.*, value.*
                 FROM ...\Models\Tags\NamespaceTag AS namespace
                     JOIN ...\Models\Tags\PredicateTag AS predicate
                     JOIN ...\Models\Tags\ValueTag AS value
            ORDER BY namespace.part, predicate.part, value.part");
$results = $tags->setHydrateMode(Resultset::TYPE_RESULT_FULL);

The models all have their hasMany and belongsTo's set. However I can't seem to access belongsTo aliases.

Trying this results in an Model PredicateTag could not be loaded

$result->namespace->predicates //predicates is a set alias

However I can access $result->predicate but I would a $result->namespace->predicates->values structure

Is it possible to return the result set fully hydrated just like Doctrine?



1.7k
Accepted
answer

Not currently possible, New feature request pending.