/** * Edit attribute form * * @param Request $request * @param int $id * * @Template("PimEnrichBundle:Attribute:form.html.twig") * @AclAncestor("pim_enrich_attribute_edit") * * @return array */ public function editAction(Request $request, $id) { $attribute = $this->findAttributeOr404($id); if ($this->attributeHandler->process($attribute)) { $this->addFlash('success', 'flash.attribute.updated'); return $this->redirectToRoute('pim_enrich_attribute_edit', ['id' => $attribute->getId()]); } return ['form' => $this->attributeForm->createView(), 'locales' => $this->localeRepository->getActivatedLocaleCodes(), 'disabledLocales' => $this->localeRepository->findBy(['activated' => false]), 'measures' => $this->measuresConfig, 'created' => $this->versionManager->getOldestLogEntry($attribute), 'updated' => $this->versionManager->getNewestLogEntry($attribute)]; }
/** * Get active locales * * @return array */ protected function getLocales() { if (null === $this->locales) { $this->locales = []; $locales = $this->localeRepository->findBy(['activated' => 1]); foreach ($locales as $locale) { $this->locales[$locale->getCode()] = $locale; } } return $this->locales; }
/** * Get locales with criterias * * @param array $criterias * * @return \Pim\Bundle\CatalogBundle\Entity\Locale[] */ public function getLocales($criterias = array()) { return $this->repository->findBy($criterias); }