/** * {@inheritdoc} */ public function load(ObjectManager $manager) { /** @var \Oro\Bundle\LocaleBundle\Model\LocaleSettings $localeSettings */ $localeSettings = $this->container->get('oro_locale.settings'); foreach ($this->statuses as $status) { $entity = new RequestStatus(); $entity->setSortOrder($status['order']); $entity->setName($status['name']); $entity->setLocale($localeSettings->getLocale())->setLabel($status['label']); $manager->persist($entity); } $manager->flush(); }
/** * Process form * * @param RequestStatus $entity * * @return bool True on successful processing, false otherwise */ public function process(RequestStatus $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(), ['POST', 'PUT'], true)) { $this->form->submit($this->request); if ($this->form->isValid()) { $this->manager->persist($entity); $this->manager->flush(); return true; } } return false; }