php - How to correctly retrieve records from a many to many relationship (Doctrine - DQL query) -
i have following dql query:
$qb->select('v, b, c, t, p, m, s, f, h') ->from('urlbuilderbundle:version', 'v') ->leftjoin('v.ddlbrands', 'b', 'with', 'b.version = v.id , b.isactive = 1 , v.isactive = 1') ->leftjoin('v.ddlcampaignobjectives', 'c', 'with', 'c.version = v.id , c.isactive = 1') ->leftjoin('v.ddlthemes', 't', 'with', 't.version = v.id , t.isactive = 1') ->leftjoin('t.ddlproducts', 'p', 'with', 'p.isactive = 1') ->leftjoin('v.ddlmediums', 'm', 'with', 'm.version = v.id , m.isactive = 1') ->leftjoin('m.ddlsources', 's', 'with', 's.ddlmedium = m.id , s.isactive = 1') ->leftjoin('v.fields', 'f', 'with', 'f.version = v.id , f.isactive = 1') ->leftjoin('f.helptext', 'h', 'with', 'h.field = f.id , h.isactive = 1'); $query = $qb->getquery(); $versions = $query->getarrayresult();
all of specified joins between tables have many one/one many relationship except between ddlproducts , ddlthemes tables. there many many relationship (ddlproducts , ddlthemes) causing problems, results in following error:
error: maximum execution time of 30 seconds exceeded @ /vendor/doctrine/orm/lib/doctrine/orm/internal/hydration/abstracthydrator.php:296)"}
can point me in right direction in resolving error?
well, querying , populating collections of 9 different interconnected entities that. without more knowledge of entire model, cannot can changed in query.
perhaps can try finding tables can denormalized other 1 avoid join. or perhaps split query in more if not need in 1 uber table.
it depends on need resultset for
Comments
Post a Comment