/** * @param DBRecord $record * @throws InvalidArgumentException * @return PDOStatement */ protected function prepareUpdateStatement(DBRecord $record) { if (!$record instanceof Role) { throw new InvalidArgumentException("Object must be instance of Role class!"); } $conn = $this->getConnection(); $stmt = $conn->prepare('UPDATE ' . DBConfig::table(DBConfig::USERS) . ' SET login=:login, email=:email, activated=:status, firstname=:fn, surname=:sn WHERE id_u=:id;'); $stmt->bindValue(':id', $record->getId(), PDO::PARAM_INT); $stmt->bindValue(':login', $record->getLogin(), PDO::PARAM_STR); $stmt->bindValue(':email', $record->getEmail(), PDO::PARAM_STR); $stmt->bindValue(':status', $record->getStatus(), PDO::PARAM_INT); $stmt->bindValue(':fn', $record->getFirstname(), PDO::PARAM_STR); $stmt->bindValue(':sn', $record->getSurname(), PDO::PARAM_STR); return $stmt; }