Ejemplo n.º 1
0
 /**
  * @param integer $practoAccountId
  * @return boolean
  */
 public function setConsultEnabled($practoAccountId)
 {
     $userEntry = $this->helper->getRepository(ConsultConstants::USER_ENTITY_NAME)->findBy(array('practoAccountId' => $practoAccountId, 'isRelative' => 0), array('createdAt' => 'ASC'));
     if (empty($userEntry)) {
         $userEntry = new UserInfo();
         $userEntry->setPractoAccountId($practoAccountId);
     } else {
         $userEntry = $userEntry[0];
     }
     $userEntry->setIsEnabled(true);
     $this->helper->persist($userEntry, true);
     $userEntry = $this->helper->getRepository(ConsultConstants::USER_ENTITY_NAME)->findBy(array('practoAccountId' => $practoAccountId, 'isRelative' => 0), array('createdAt' => 'ASC'));
     if (empty($userEntry)) {
         @($error['error'] = 'No entry was made');
         throw new ValidationError($error);
     }
     return $userEntry[0]->getIsEnabled();
 }