127 lines
2 KiB
PHP
127 lines
2 KiB
PHP
<?php
|
|
|
|
namespace Model\Data;
|
|
|
|
use Phalcon\Mvc\Model;
|
|
|
|
class User extends Model
|
|
{
|
|
protected $id;
|
|
|
|
protected $username;
|
|
|
|
protected $email;
|
|
|
|
protected $deleted;
|
|
|
|
protected $password;
|
|
|
|
public function initialize()
|
|
{
|
|
$this->useDynamicUpdate(true);
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getId()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $id
|
|
* @return User
|
|
*/
|
|
public function setId($id)
|
|
{
|
|
$this->id = $id;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getUsername()
|
|
{
|
|
return $this->username;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $username
|
|
* @return User
|
|
*/
|
|
public function setUsername($username)
|
|
{
|
|
$this->username = $username;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getEmail()
|
|
{
|
|
return $this->email;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $email
|
|
* @return User
|
|
*/
|
|
public function setEmail($email)
|
|
{
|
|
$this->email = $email;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getDeleted()
|
|
{
|
|
return $this->deleted;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $deleted
|
|
* @return User
|
|
*/
|
|
public function setDeleted($deleted)
|
|
{
|
|
$this->deleted = $deleted;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getPassword()
|
|
{
|
|
return $this->password;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $password
|
|
* @return User
|
|
*/
|
|
public function setPassword($password)
|
|
{
|
|
$this->password = $password;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Find the first user by Username or Email
|
|
*
|
|
* @param string $value
|
|
* @return User|bool
|
|
*/
|
|
static public function findFirstByUsernameOrEmail($value)
|
|
{
|
|
return self::findFirst([
|
|
"email = :v: OR username = :v:",
|
|
"bind" => [ 'v' => $value ]
|
|
]);
|
|
}
|
|
}
|