We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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?



2.6k
Accepted
answer

Not currently possible, New feature request pending.