Symfony2의 특정 user_id와 일치하는 데이터베이스에서 모든 레코드를 삭제하고 싶습니다.symfony2 Doctrine 객체 배열 삭제
$em = $this->getDoctrine()->getManager();
$user_service = $em->getRepository('ProjectTestBundle:UserService')
->findByUser($this->getUser()->getId());
이 몇 일치하는 객체를 반환 할 수 있습니다, 그래서 실행하면
는$em->remove($user_service);
$em->flush();
오류가 발생합니다
EntityManager#remove() expects parameter 1 to be an entity object, array given.
을 내가 특정 일치하는 모든 레코드 (개체)를 제거하려면 어떻게 조건? Btw, mysql에서 동등한 sql 문을 실행하면 완벽하게 작동합니다.
대단히 감사합니다. Markus. – Davit
문제 없음, 때때로 나무를위한 숲이 보이지 않음 ... 발생 : P –
실은 :)) 나는 while/for 루프 전에 시도했다. foreach에 대해 잠시 잊어 버렸습니다. – Davit