/** * Process form * * @param EmailTemplate $entity * * @return bool True on successful processing, false otherwise */ public function process(EmailTemplate $entity) { // always use default locale during template edit in order to allow update of default locale $entity->setLocale($this->defaultLocale); if ($entity->getId()) { // refresh translations $this->manager->refresh($entity); } $this->form->setData($entity); if (in_array($this->request->getMethod(), array('POST', 'PUT'))) { // deny to modify system templates if ($entity->getIsSystem() && !$entity->getIsEditable()) { $this->form->addError(new FormError($this->translator->trans('oro.email.handler.attempt_save_system_template'))); return false; } $this->form->submit($this->request); if ($this->form->isValid()) { // mark an email template creating by an user as editable if (!$entity->getId()) { $entity->setIsEditable(true); } $this->manager->persist($entity); $this->manager->flush(); return true; } } return false; }