예제 #1
0
 public function insertNewRoad(Roadrout $road)
 {
     if ($this->validate($road)) {
         $roadScope = new QueryScope("roadrout");
         $roadScope->setFields(array("id", "driverid", "start", "start_adress", "finish", "finish_adress", "terms", "autoid", "freeseats", "price", "startdate", "timetrip", "status"));
         $roadScope->setValues(array($road->id, $road->driverid, $road->start, $road->start_adress, $road->finish, $road->finish_adress, $road->terms, $road->autoid, $road->freeseats, $road->price, $road->startdate, $road->timetrip, $road->status));
         $this->addQueryScope($roadScope);
         return $this->insert();
     }
     return false;
 }
예제 #2
0
 public function insertNewCar(Car $car)
 {
     if ($this->validate($car)) {
         $carScope = new QueryScope("car");
         $carScope->setFields(array("regnumber", "userid", "brand", "model", "color", "seats", "photo", "fuelrate"));
         $carScope->setValues(array($car->regnumber, $car->userid, $car->brand, $car->model, $car->color, $car->seats, $car->photo, $car->fuelrate));
         $this->addQueryScope($carScope);
         return $this->insert();
     }
     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;
 }