protected function getActivePropertyAccess() { $propertyId = $this->propertyId; $userId = Yii::app()->user->getState('id'); $linkModel = new User2property(); $link = $linkModel->findByAttributes(array('userId' => $userId, 'propertyId' => $propertyId)); if ($link) { $this->linkWithProperty = $link; $this->access = $link->getAttribute('access'); } else { $this->linkWithProperty = null; $this->access = 1000; } return $this->access; }