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