コード例 #1
0
 public function deleteImages(User $user)
 {
     $em = $this->getEntityManager();
     $imageRepository = $em->getRepository('MMIJubGalerieBundle:Image');
     $images = $imageRepository->findBy(array('user' => $user->getId()));
     foreach ($images as $image) {
         $em->remove($image);
     }
     $em->flush();
 }
コード例 #2
0
 /**
  *
  * Trouve une ligne d'association entre un ci et un utilisateur
  *
  * @param Ci $ci
  * @param User $user
  */
 public function findByIdCiAndIdUser(Ci $ci, User $user)
 {
     $qb = $this->createQueryBuilder('a');
     $qb->where('a.ciP = :ci')->setParameter('ci', $ci->getId())->andWhere('a.user = :user')->setParameter('user', $user->getId());
     return $qb->getQuery()->getResult();
 }