This is a One2Many entity in the form so it appears more than once. However, it queries the database for each row. Shouldn't it only do this once?
- Code: Select all
$builder
->add('preset_parent', 'entity', array(
'property' => 'title',
'class' => 'Vivo\JobsystemBundle\Entity\Component',
'empty_value' => '',
'query_builder' => function(EntityRepository $er) {
return $er->createQueryBuilder('c')
->where('c.status = :status')
->setParameter('status', Component::STATUS_PRESET)
->orderBy('c.title', 'asc')
;
},
'attr' => array(
'class' => 'preset_parent',
)
))
+ SELECT v0_.id AS id0, v0_.status AS status1, v0_.title AS title2, v0_.description AS description3, v0_.price AS price4, v0_.created_at AS created_at5, v0_.updated_at AS updated_at6, v0_.parent_id AS parent_id7, v0_.project_id AS project_id8 FROM vivo_jobsystem_component v0_ WHERE v0_.status = ? ORDER BY v0_.title ASC
Parameters: [0]
Time: 13.62 ms
+ SELECT v0_.id AS id0, v0_.status AS status1, v0_.title AS title2, v0_.description AS description3, v0_.price AS price4, v0_.created_at AS created_at5, v0_.updated_at AS updated_at6, v0_.parent_id AS parent_id7, v0_.project_id AS project_id8 FROM vivo_jobsystem_component v0_ WHERE v0_.status = ? ORDER BY v0_.title ASC
Parameters: [0]
Time: 0.46 ms
+ SELECT v0_.id AS id0, v0_.status AS status1, v0_.title AS title2, v0_.description AS description3, v0_.price AS price4, v0_.created_at AS created_at5, v0_.updated_at AS updated_at6, v0_.parent_id AS parent_id7, v0_.project_id AS project_id8 FROM vivo_jobsystem_component v0_ WHERE v0_.status = ? ORDER BY v0_.title ASC
Parameters: [0]
Time: 22.80 ms
+ SELECT v0_.id AS id0, v0_.status AS status1, v0_.title AS title2, v0_.description AS description3, v0_.price AS price4, v0_.created_at AS created_at5, v0_.updated_at AS updated_at6, v0_.parent_id AS parent_id7, v0_.project_id AS project_id8 FROM vivo_jobsystem_component v0_ WHERE v0_.status = ? ORDER BY v0_.title ASC
Parameters: [0]
Time: 0.51 ms
