protected function errorFlashBag($text) { $session = $this->get('session'); $flashBag = $session->getFlashBag(); $translator = $this->get('translator'); $flashBag->add('error', $translator->trans($text)); return true; }