4
$repository = $this->getDoctrine()->getRepository('ParabolaEntityBundle:ProjectAllocation');
$query = $repository->createQueryBuilder('p')
->where('p.startDate < :sdate and p.employee = :emp and p.endDate > :edate')
->setParameter('sdate', date('Y-m-d', time()))
->setParameter('edate', date('Y-m-d', time()))
->setParameter('emp', $employee->getId())
->getQuery();
$projectAllocate = $query->getResult();
FormType 클래스에서 위의 코드를 어떻게 사용할 수 있습니까?이 쿼리를 사용하여 양식 작성기에서 선택 유형에 대한 배열을 생성하고 있습니다.symfony2의 form type 클래스에서 doctrine 저장소를 얻는 방법은 무엇입니까?
엔티티 양식에서 중첩 된 쿼리를 사용하는 방법을 입력하십시오. 제 경우에는 프로젝트 할당 엔티티에 대한 프로젝트 엔티티베이스를 가져와야하기 때문입니다. –
확실히 할 수있는 방법이 있습니다.이 두 엔티티가 어떻게 관련되어 있는지 설명해 주시겠습니까? 유니/양방향? 카디널리티? –
비슷한 문제가 있습니다. 나는 그들 사이에 관계를 사용하고 싶지 않은 두 엔티티가 있습니다. 나는 관련 질의 응답을 찾았습니다 : [formBuilder로 데이터를 전달하는 방법] (http://stackoverflow.com/questions/6716776/symfony-2-how-to-pass-data-to-formbuilder) 및 [컨트롤러에서 데이터 전달하기] ] (http://stackoverflow.com/questions/7807388/passing-data-from-controller-to-type-symfony2) – renoirb