Author: Adam Piotrowski (adam@wellcommerce.org)
Inheritance: implements WellCommerce\Bundle\LocaleBundle\Entity\LocaleInterface, use trait Knp\DoctrineBehaviors\Model\Timestampable\Timestampable, use trait Knp\DoctrineBehaviors\Model\Blameable\Blameable, use trait WellCommerce\Bundle\CurrencyBundle\Entity\CurrencyAwareTrait
 public function create() : LocaleInterface
 {
     $locale = new Locale();
     $locale->setCode('');
     $locale->setEnabled(true);
     $locale->setCurrency(null);
     return $locale;
 }
Esempio n. 2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     if (!$this->isEnabled()) {
         return;
     }
     $en = new Locale();
     $en->setCode('en');
     $en->setCurrency($this->getReference('currency_USD'));
     $manager->persist($en);
     $manager->flush();
     $this->setReference('locale_en', $en);
 }
Esempio n. 3
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $pl = new Locale();
     $pl->setCode('pl');
     $manager->persist($pl);
     $en = new Locale();
     $en->setCode('en');
     $manager->persist($en);
     $de = new Locale();
     $de->setCode('de');
     $manager->persist($de);
     $fr = new Locale();
     $fr->setCode('fr');
     $manager->persist($fr);
     $manager->flush();
 }
 /**
  * Returns category slug
  *
  * @param Locale $locale
  * @param string $categoryName
  *
  * @return mixed|string
  */
 protected function getLocaleSlug(Locale $locale, $categoryName)
 {
     $slug = Sluggable::makeSlug($categoryName);
     $currentLocale = $this->getRequestHelper()->getCurrentLocale();
     if ($locale->getCode() != $currentLocale) {
         $slug = Sluggable::makeSlug(sprintf('%s-%s', $categoryName, $locale->getCode()));
     }
     return $slug;
 }