Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Models;
- /** @Entity @Table(name="user") */
- class User extends \My\Model\AbstractModel implements \Zend_Acl_Role_Interface
- {
- /**
- * @Id @Column(type="integer")
- * @GeneratedValue(strategy="AUTO")
- */
- protected $id;
- /** @Column(type="integer", unsigned=true) */
- protected $role_id;
- /** @Column(type="string") */
- protected $username;
- /** @Column(type="string") */
- protected $password;
- /** @Column(type="string") */
- protected $email;
- /** @Column(type="string") */
- protected $date_format;
- /** @Column(type="string") */
- protected $time_format;
- /** @Column(type="boolean") */
- protected $calendar_start;
- /** @Column(type="datetime") */
- protected $created;
- /** @Column(type="datetime") */
- protected $updated;
- /**
- * @OneToOne(targetEntity="Role")
- * @JoinColumn(name="role_id", referencedColumnName="id")
- */
- protected $role;
- /**
- * Initialization
- */
- public function init()
- {
- $this->created = $this->updated = new \DateTime('now');
- }
- /**
- * @PreUpdate
- */
- public function updated()
- {
- $this->updated = new \DateTime('now');
- }
- /**
- * @return the $id
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * @return the $username
- */
- public function getUsername()
- {
- return $this->username;
- }
- /**
- * @return the $password
- */
- public function getPassword()
- {
- return $this->password;
- }
- /**
- * @return the $email
- */
- public function getEmail()
- {
- return $this->email;
- }
- /**
- * @return the $calendar_start
- */
- public function getCalendarStart()
- {
- return $this->calendar_start;
- }
- /**
- * @return $role_id
- */
- public function getRoleId()
- {
- return $this->role->getName();
- }
- /**
- * @return the $role
- */
- public function getRole()
- {
- return $this->role;
- }
- /**
- * @param $id the $id to set
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * @param $username the $username to set
- */
- public function setUsername($username)
- {
- $this->username = $username;
- return $this;
- }
- /**
- * @param $password the $password to set
- */
- public function setPassword($password)
- {
- $this->password = $password;
- return $this;
- }
- /**
- * @param $email the $email to set
- */
- public function setEmail($email)
- {
- $this->email = $email;
- return $this;
- }
- /**
- * @param $calendar_start the $calendar_start to set
- */
- public function setCalendarStart($calendar_start)
- {
- $this->calendar_start = $calendar_start;
- return $this;
- }
- /**
- * @param $role the $role to set
- */
- public function setRole($role)
- {
- $this->role = $role;
- return $this;
- }
- /**
- * Callback for determining if role is valid
- *
- * @param mixed $value
- * @return true if $value is an instance of \Models\Role
- */
- public function cbIsRole($value)
- {
- return $value instanceof Role;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement