예제 #1
0
 /**
  * {@inheritDoc}
  */
 public function setNewGeneratedId()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setNewGeneratedId', array());
     return parent::setNewGeneratedId();
 }
예제 #2
0
파일: Doctrine.php 프로젝트: rukzuk/rukzuk
 /**
  * @param array   $attributes
  * @param boolean $useAttributesId
  *
  * @return \Orm\Entity\Website
  */
 public function create($attributes, $useAttributesId = false)
 {
     $website = new Website();
     try {
         if ($useAttributesId && isset($attributes['id'])) {
             $website->setId($attributes['id']);
         } else {
             $website->setNewGeneratedId();
         }
         $website->setShortId($this->createShortId());
         $this->setAttributesToWebsite($attributes, $website);
         $website->setCreationMode(\Cms\Version::getMode());
         $website->setMarkedForDeletion(false);
         $this->getEntityManager()->persist($website);
         $this->getEntityManager()->flush();
         $this->getEntityManager()->refresh($website);
     } catch (Exception $e) {
         throw new CmsException(606, __METHOD__, __LINE__, null, $e);
     }
     return $website;
 }