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; }
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; }
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; }