Пример #1
0
 public function createDefaultEntity()
 {
     $tree = new SiteTree();
     $tree->setSiteHomePageID(HOME_CID);
     $locale = new Locale();
     $locale->setLanguage('en');
     $locale->setCountry('US');
     $locale->setSiteTree($tree);
     $site = new Site($this->config);
     $site->setSiteHandle('default');
     $site->setIsDefault(true);
     $tree->setLocale($locale);
     return $site;
 }
Пример #2
0
 public function add(Site $site, $language, $country)
 {
     $tree = new SiteTree();
     $this->entityManager->persist($tree);
     $this->entityManager->flush();
     $locale = new Locale();
     $locale->setCountry($country);
     $locale->setLanguage($language);
     $locale->setSite($site);
     $tree->setLocale($locale);
     $locale->setSiteTree($tree);
     $locale = $this->updatePluralSettings($locale);
     $this->entityManager->persist($tree);
     $this->entityManager->persist($locale);
     $this->entityManager->flush();
     return $locale;
 }
Пример #3
0
 public function installDefault($locale = null)
 {
     if (!$locale) {
         $locale = Localization::BASE_LOCALE;
     }
     $siteConfig = $this->config->get('site');
     $defaultSite = array_get($siteConfig, 'default');
     $factory = new Factory($this->config);
     $site = $factory->createEntity();
     $site->setSiteHandle(array_get($siteConfig, "sites.{$defaultSite}.handle"));
     $site->setIsDefault(true);
     $data = explode('_', $locale);
     $locale = new Locale();
     $locale->setSite($site);
     $locale->setIsDefault(true);
     $locale->setLanguage($data[0]);
     $locale->setCountry($data[1]);
     $tree = new SiteTree();
     $tree->setSiteHomePageID(HOME_CID);
     $tree->setLocale($locale);
     $locale->setSiteTree($tree);
     $site->getLocales()->add($locale);
     $service = $this->app->make('site/type');
     $type = $service->getDefault();
     $site->setType($type);
     $this->entityManager->persist($site);
     $this->entityManager->flush();
     return $site;
 }