Monday, 15 March 2010

php - Doctrine generates 300+ queries, how can I avoid that? -



php - Doctrine generates 300+ queries, how can I avoid that? -

i'd understand little problem on symfony's project.

the database simple :

article

--id --name

tarif

--id --idarticle --seuil (threshold) --prix (price) --devise (currency)

i want select article have cost in euro query :

doctrine_query::create()->from('article') ->innerjoin('article.tarif tarif') ->where('tarif.devise = ?', '0') ->execute();

but in debug page have more 300 query, main query :

select a.id a__id, a.lot a__lot, a.ref a__ref, a.reflama a__reflama, a.refoem a__refoem, a.designation a__designation, a.idfamille a__idfamille, a.idcategorie a__idcategorie, a.couleur a__couleur, a.contenance a__contenance, a.poids a__poids, a.nbpages a__nbpages, a.etat a__etat, a.pack a__pack, a.pcb a__pcb, t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise article inner bring together tarif t on a.id = t.idarticle (t.devise = '0')

and lot of other :

select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '2') 0.00s, "doctrine" connection select t.id t__id, t.idarticle t__idarticle, t.seuil t__seuil, t.prix t__prix, t.devise t__devise tarif t (t.idarticle = '3') 0.00s, "doctrine" connection

how can remove useless query ?

php mysql doctrine symfony-1.4

No comments:

Post a Comment