コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function save(array $parameters)
 {
     if (null === $this->alLanguage || $this->alLanguage->getId() == null) {
         return $this->add($parameters);
     }
     return $this->edit($parameters);
 }
コード例 #2
0
ファイル: DataManager.php プロジェクト: iicc/RedKiteCmsBundle
 /**
  * Initializes the DataManager object from the database entities
  *
  * @param Language $language
  * @param Page     $page
  */
 public function fromEntities(Language $language = null, Page $page = null)
 {
     $this->language = $language;
     $this->page = $page;
     if (null !== $this->language && null !== $this->page) {
         $options = array("languageId" => $this->language->getId(), "pageId" => $this->page->getId());
         $this->seo = $this->setupSeo($options);
     }
 }
コード例 #3
0
 /**
  * Fetches the base language used to copy the entities
  *
  * @return \RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Model\Language
  */
 protected function getBaseLanguage()
 {
     $languageRepository = $this->languageManager->getLanguageRepository();
     // Tries to fetch the current language from the request
     if (null !== $this->request) {
         $languages = $this->request->getLanguages();
         $alLanguage = $languageRepository->fromLanguageName($languages[1]);
         if (null !== $alLanguage) {
             return $alLanguage;
         }
         // @codeCoverageIgnoreStart
     }
     // @codeCoverageIgnoreEnd
     // Fetches the current language from the main language when the adding one is not the main language
     if ($this->mainLanguage->getId() != $this->languageManager->get()->getId()) {
         return $this->mainLanguage;
     }
     return $languageRepository->firstOne();
 }