Exemplo n.º 1
0
function copyFormData(\StudentList\Student $student)
{
    $firstName = trim(isset($_POST["firstName"]) ? strval($_POST["firstName"]) : "");
    $student->setFirstName($firstName);
    $lastName = trim(isset($_POST["lastName"]) ? strval($_POST["lastName"]) : "");
    $student->setLastName($lastName);
    $groupNumber = trim(isset($_POST["groupNumber"]) ? strval($_POST["groupNumber"]) : "");
    $student->setGroupNumber($groupNumber);
    $email = trim(isset($_POST["email"]) ? strval($_POST["email"]) : "");
    $student->setEmail($email);
    $mark = trim(isset($_POST["mark"]) ? strval($_POST["mark"]) : "");
    $student->setMark($mark);
    $birthYear = trim(isset($_POST["birthYear"]) ? strval($_POST["birthYear"]) : "");
    $student->setBirthYear($birthYear);
    $sex = isset($_POST["sex"]) ? strval($_POST["sex"]) : "";
    $student->setSex($sex);
    $locality = isset($_POST["locality"]) ? strval($_POST["locality"]) : "";
    $student->setLocality($locality);
}
Exemplo n.º 2
0
 public function updateStudentData(Student $student)
 {
     $data = ["id" => $student->getId(), "firstName" => $student->getFirstName(), "lastName" => $student->getLastName(), "sex" => $student->getSex(), "mark" => $student->getMark(), "birthYear" => $student->getBirthYear(), "isLocal" => $student->getLocality(), "groupNumber" => $student->getGroupNumber(), "email" => $student->getEmail(), "password" => $student->getPassword()];
     $sql = "UPDATE student_data\n                SET firstName = :firstName, lastName = :lastName, sex = :sex,\n                    mark = :mark, birthYear = :birthYear, isLocal = :isLocal,\n                    groupNumber = :groupNumber, email = :email, password = :password\n                WHERE id = :id";
     $statement = $this->studentDb->prepare($sql);
     $statement->execute($data);
 }