Penetal
Penetal

Reputation: 83

Related db tables with zend framework 2

what would be the best way to get a result from a table using the table gateway component of zf2 and also get the related child result(s) of those?

mysql tables (arrow pointing to parent) :

article <- comment(s)

article(s) <-xref->author(s)

is join the only/best way to do this or do you guys have a better way to handle this?

Upvotes: 0

Views: 557

Answers (1)

Sam
Sam

Reputation: 16445

ZF2 went back a step from providing full ORM functionalities like ZF1s findDependentRowset() or similar. This, iirc, was mostly due to the high complexity and bloatedness of the Zend\Db module.

You still have ways to make this happen, with the method you named yourself join, writing native queries, or to rely on the functionality of custom ORMs like Doctrine 2 which has a fairly great implementation in ZF2 nowadays.

You may want to consider doctrine/DoctrineORMModule

Upvotes: 2

Related Questions