symfony2 and doctrine and children in where clause

Saturday, July 5, 2014

i tried to select one record with its children as below:



$job = $em->getRepository('RaxcidoBaseBundle:Job')->findOneById($id);


it will return me an array that has record and all children as well. now i want to select this job if has child with a name='test', what is the solution? i prefer to use docrine functions, not query


these are my entities



<?php
...
class Job
{
...
/**
* @ORM\OneToMany(targetEntity="JobPrerequisite", mappedBy="job")
*/
protected $prerequisites;


and



<?php
...
class JobPrerequisite
{
...
/**
* @ORM\ManyToOne(targetEntity="Job", inversedBy="prerequisites")
* @orm\JoinColumn(name="job_id", referencedColumnName="id")
*/
protected $job;

/**
* @orm\Column(type="string")
*/
protected $name;


thanks







http://ift.tt/1oocnAl