return $this->validate;
    }
    public function getAge($birth_year, $birth_month, $birth_day)
    {
        $birthday = $birth_year . "-" . $birth_month . "-" . $birth_day;
        $age = date_create($birthday)->diff(date_create('today'))->y;
        return $age;
    }
}
// End class PersonController
if (array_key_exists('addNewContact', $_POST)) {
    $cPerson = new PersonController((int) $_POST['personId'], trim($_POST['lastName']), trim($_POST['firstName']), trim($_POST['middleName']), trim($_POST['aliasName']), (int) $_POST['birthMonth'], (int) $_POST['birthDay'], (int) $_POST['birthYear'], trim($_POST['note']));
    $model = new PersonPDO();
    if ($cPerson->nameFieldValidate()) {
        if (isset($_GET['action']) && $_GET['action'] === 'create') {
            $insertId = $model->create($cPerson);
            header("Location: ../profile.php?id=" . (int) $insertId);
        }
        if (isset($_GET['action']) && $_GET['action'] === 'update') {
            $model->updateById($cPerson);
            header("Location: ../profile.php?id=" . $_POST['personId']);
        }
    } elseif ($_GET['action'] === 'update') {
        header("Location: ../newcontact.php?id={$_POST['personId']}&action=update&validate=error");
    } else {
        header("Location: ../newcontact.php?validate=error");
    }
}
/*
 * Delete a contact and return to the list
 */