コード例 #1
0
 public function __construct(User $user)
 {
     $this->userId = $user->getId();
     $this->fullName = $user->getFullname();
     $this->username = $user->getUsername();
 }
コード例 #2
0
 private static function insert(User $model)
 {
     $db = DatabaseData::getInstance(\RedDevil\Config\DatabaseConfig::DB_INSTANCE);
     $query = "INSERT INTO users (username,email,password,fullname,telephone) VALUES (:username, :email, :password, :fullname, :telephone);";
     $result = $db->prepare($query);
     $result->execute([':username' => $model->getUsername(), ':email' => $model->getEmail(), ':password' => $model->getPassword(), ':fullname' => $model->getFullname(), ':telephone' => $model->getTelephone()]);
     $model->setId($db->lastInsertId());
 }