コード例 #1
0
 /**
  * {@inheritDoc}
  */
 public function setId($id)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setId', array($id));
     return parent::setId($id);
 }
コード例 #2
0
ファイル: Doctrine.php プロジェクト: rukzuk/rukzuk
 /**
  * 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);
 }