public function register(array $userData) { //$this->userDao->getUserByUsername($userData['username']); //TODO: Ashot userData validation and insert/update payman karochi if (!$userData['userId']) { $userId = $this->userDao->createUser($userData); } else { return $this->userDao->updateUser($userData); } Notification::success(3, '_(Registered Successfully)'); return $userId; }
public function saveOrder(Order $order) { /** @var Client $client */ $client = $order->getClient(); if (empty($client->getClientId())) { $clientData = $client->toArray(); $clientData['role'] = Defines::ROLE_CLIENT; $clientId = $this->userDao->createUser($clientData); $order->setClientId($clientId); } if (empty($order->getOrderId())) { $orderId = $this->orderDao->crateOrder($order); $order->setOrderId($orderId); } else { $this->orderDao->editOrder($order); } return $order->toArray(); }