public function delete($varname) { $property = $this->em->getRepository('Newscoop\\NewscoopBundle\\Entity\\SystemPreferences')->findOneBy(array('option' => $varname)); if ($property) { $this->em->remove($property); $this->em->flush(); } }