Пример #1
0
 public function getByUser($email)
 {
     $roadScope = new QueryScope("roadrout");
     $roadScope->setFields(array("*"));
     $roadCond = new QueryCondition("roadrout");
     $roadCond->setConditions(array(new QueryConditionMember("driverid", $email, "=")));
     $this->addQueryScope($roadScope);
     $this->addQueryCondition($roadCond);
     return $this->select()->fetchAll(PDO::FETCH_CLASS, 'Entity\\Roadrout');
 }
Пример #2
0
 public function updateCar(Car $car)
 {
     if ($this->validate($car)) {
         $carScope = new QueryScope("car");
         $carScope->setFields(array("brand", "model", "color", "seats", "fuelrate"));
         $carScope->setValues(array($car->brand, $car->model, $car->color, $car->seats, $car->fuelrate));
         $carCond = new QueryCondition("car");
         $carCond->setConditions(array(new QueryConditionMember("regnumber", $car->regnumber, "=")));
         $this->addQueryScope($carScope);
         $this->addQueryCondition($carCond);
         return $this->update();
     }
     return false;
 }
Пример #3
0
 public function updateUser(User $user)
 {
     if ($this->validate($user)) {
         $userScope = new QueryScope("user");
         $userScope->setFields(array("username", "surname", "birthday", "gendor", "phone", "userpassword"));
         $userScope->setValues(array($user->username, $user->surname, $user->birthday, $user->gendor, $user->phone, $user->userpassword));
         $userCond = new QueryCondition("user");
         $userCond->setConditions(array(new QueryConditionMember("email", $user->email, "=")));
         $this->addQueryScope($userScope);
         $this->addQueryCondition($userCond);
         return $this->update();
     }
     return false;
 }