/** * Finds an appropriate contentunit for the given banner * * @param Banner $banner * @return AppBundle\Entity\Contentunit */ protected function findContentunit(Banner $banner) { $em = $this->getDoctrine()->getManager(); return $em->getRepository('AppBundle:Contentunit')->findByImage($banner->getImageFile()); }