/**
  * {@inheritDoc}
  */
 public function setWebsiteid($websiteid)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setWebsiteid', array($websiteid));
     return parent::setWebsiteid($websiteid);
 }
示例#2
0
 /**
  * creates a new WebsiteSettings
  *
  * @param WebsiteSettingsSource $source
  * @param DataWebsiteSettings   $websiteSettings
  *
  * @return DataWebsiteSettings
  * @throws \Cms\Exception
  */
 public function create(WebsiteSettingsSource $source, DataWebsiteSettings $websiteSettings)
 {
     $settingsId = $websiteSettings->getId();
     if (empty($settingsId)) {
         throw new CmsException(2513, __METHOD__, __LINE__);
     }
     $websiteId = $source->getWebsiteId();
     if (empty($websiteId)) {
         throw new CmsException(2512, __METHOD__, __LINE__);
     }
     if ($this->exists($source, $settingsId)) {
         throw new CmsException(2514, __METHOD__, __LINE__);
     }
     try {
         $orm = new OrmWebsiteSettings();
         $orm->setWebsiteid($websiteId);
         $orm->setId($settingsId);
         $this->setAttributesToOrm($orm, $websiteSettings);
         $entityManager = $this->getEntityManager();
         $entityManager->persist($orm);
         $entityManager->flush();
         $entityManager->refresh($orm);
         $this->clearEntityManager();
     } catch (\Exception $e) {
         throw new CmsException(2511, __METHOD__, __LINE__, null, $e);
     }
     return $this->convertOrm($orm);
 }