Esempio n. 1
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;
 }
Esempio n. 2
0
 public function crateOrder(Order $order)
 {
     return $this->db->insert('orders', $order->toArray());
 }