/** * @return Application_Model_User_Profile */ public function getProfile() { if (!$this->_profile instanceof Application_Model_User_Profile) { $this->_profile = Application_Model_User_Profile::getById($this->getIdUser()); } return $this->_profile; }
public function getUser() { if (!$this->_user && $this->getIdUser()) { $this->_user = User::getById($this->getIdUser()); } return $this->_user; }
protected function __setData(stdClass $data) { $this->__setContentFields(); $photo = RM_Photo::getById($data->id_photo); if (!$photo instanceof RM_Photo) { throw new Exception('Не выбрана фотография'); } if (empty($data->id_posts)) { throw new Exception('Не выбрана должность'); } $this->_entity->setPhoto($photo); $postCollection = $this->_entity->getPostCollection(); $postCollection->resetItems(); foreach ($data->id_posts as $idPost) { $post = Application_Model_Medical_Post::getById($idPost); if ($post instanceof Application_Model_Medical_Post) { $postCollection->add($post); } } $serviceCollection = $this->_entity->getServiceCollection(); $serviceCollection->resetItems(); foreach ($data->id_services as $idService) { $service = Application_Model_Medical_Service::getById($idService); if ($service instanceof Application_Model_Medical_Service) { $serviceCollection->add($service); } } $this->_initWorkTimeList($data); $user = Application_Model_User_Profile::getById($data->id_user); if ($user instanceof Application_Model_User_Profile) { $this->_entity->setUser($user); } else { $this->_entity->resetUser(); } $this->_entity->setReceptionDuration(new MedOptima_DateTime_Duration_InsideDay((int) $data->reception_duration)); }