protected function getUnit($name) { $repository = $this->entityManager->getRepository('PartKeeprUnitBundle:Unit'); return $repository->findOneBy(['name' => $name]); }