Exemplo n.º 1
0
 public function toArray()
 {
     $data = parent::toArray();
     $data['start'] = isset($this->start) ? $this->start->format('Y-m-d H:i:s') : '';
     $data['end'] = isset($this->end) ? $this->end->format('Y-m-d H:i:s') : '';
     $data['client'] = isset($this->client) ? $this->client->toArray() : [];
     $data['title'] = isset($this->orderId) ? $this->orderId : '';
     return $data;
 }
Exemplo n.º 2
0
 public function createUser(array $userData)
 {
     $user = new User($userData);
     if (empty($user->getUserName())) {
         $user->setUserName('user' . App::getCounterNextIndex('user'));
     }
     $userId = $this->db->insert('users', $user->toArray());
     switch ($user->getRole()) {
         case Defines::ROLE_CLIENT:
             $client = new Client($userData);
             $client->setUserId($userId);
             $this->db->insert('clients', $client->toArray());
             break;
         case Defines::ROLE_DOCTOR:
             $doctor = new Doctor($userData);
             $doctor->setUserId($userId);
             $this->db->insert('doctors', $doctor->toArray());
             break;
     }
     return $userId;
 }
Exemplo n.º 3
0
 public function findClients(Client $client)
 {
     $filter = $client->toArray();
     $filter['role'] = Defines::ROLE_CLIENT;
     return $this->userDao->getUsersList($filter);
 }