/** * @param User $user * @return UserDataObject */ public function mapToDataObject(User $user) { $userDataObject = new UserDataObject(); $userDataObject->id = $user->getId(); $userDataObject->name = $user->getName(); $userDataObject->passwordHash = $user->getPasswordHash(); return $userDataObject; }
public function persist(User $user) { $query = "INSERT INTO USERS VALUES (:user_id, :user_name, :user_password)"; return $this->connection->executeQuery($query, [':user_id' => $user->getId(), ':user_name' => $user->getName(), ':user_password' => $user->getPassword()]); }