/**
  * {@inheritDoc}
  */
 public function setNewGeneratedId()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setNewGeneratedId', array());
     return parent::setNewGeneratedId();
 }
Beispiel #2
0
 /**
  * @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;
 }