/**
  * {@inheritDoc}
  */
 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) parent::getId();
     }
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array());
     return parent::getId();
 }
Esempio n. 2
0
 /**
  * Update review ids saved in session
  * used for connection between anonymous user and his reviews
  *
  * @param \XLite\Module\XC\Reviews\Model\Review $entity Entity
  *
  * @return bool
  */
 protected function updateReviewIds(\XLite\Module\XC\Reviews\Model\Review $entity)
 {
     if (!$this->getProfile()) {
         $reviewIds = \XLite\Core\Session::getInstance()->reviewIds;
         if (!is_array($reviewIds)) {
             $reviewIds = array();
         }
         if ($entity->getId()) {
             array_push($reviewIds, $entity->getId());
         }
         \XLite\Core\Session::getInstance()->reviewIds = array_unique($reviewIds);
     }
     return true;
 }
Esempio n. 3
0
 /**
  * Define if review is added by current user
  *
  * @return boolean
  */
 public function isOwnReview(\XLite\Module\XC\Reviews\Model\Review $entity)
 {
     $profile = \XLite\Core\Auth::getInstance()->getProfile();
     $result = false;
     if ($profile) {
         $result = $entity->getProfile() == $profile;
     } else {
         $reviewIds = \XLite\Core\Session::getInstance()->reviewIds;
         if (is_array($reviewIds)) {
             $result = in_array($entity->getId(), $reviewIds);
         }
     }
     return $result;
 }