Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace WX\ExchangeBundle\Entity;
- use Gedmo\Mapping\Annotation as Gedmo;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Security\Core\User\AdvancedUserInterface;
- use Doctrine\Common\Collections\ArrayCollection;
- use Symfony\Component\Validator\Constraints as Assert;
- use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
- /**
- * TblUser
- *
- * @ORM\Entity(repositoryClass="WX\ExchangeBundle\Entity\UserRepository")
- *
- * @ORM\Table(name="tbl_user", uniqueConstraints={@ORM\UniqueConstraint(name="email_UNIQUE", columns={"email"}), @ORM\UniqueConstraint(name="fk_profileid_UNIQUE", columns={"fk_profileid"}), @ORM\UniqueConstraint(name="username_UNIQUE", columns={"username"}), @ORM\UniqueConstraint(name="loginid_UNIQUE", columns={"loginid"}), @ORM\UniqueConstraint(name="pwdexpiredtoken_UNIQUE", columns={"pwdexpiredtoken"}), @ORM\UniqueConstraint(name="confirmation_UNIQUE", columns={"confirmation"})}, indexes={@ORM\Index(name="fk_statusid_idx", columns={"fk_status"})})
- * @UniqueEntity(fields={"email"}, groups={"registration"})
- * @UniqueEntity(fields={"username"}, groups={"registration"})
- */
- class TblUser implements AdvancedUserInterface, \Serializable
- {
- /**
- * @var string
- *
- * @ORM\Column(name="email", type="string", length=254, nullable=false)
- * @Assert\NotBlank(groups={"registration"})
- * @Assert\Email(groups={"registration"})
- */
- protected $email;
- /**
- * @var datetime
- *
- * @Gedmo\Timestampable(on="create")
- * @ORM\Column(name="created_at", type="datetime")
- */
- private $createdAt;
- /**
- * @var datetime
- *
- * @Gedmo\Timestampable(on="update")
- * @ORM\Column(name="modified_at", type="datetime")
- */
- private $modifiedAt;
- /**
- * @var \DateTime
- *
- * @ORM\Column(name="last_login", type="datetime", nullable=true)
- */
- protected $lastLogin;
- /**
- * @var string
- *
- * @ORM\Column(name="google_id", type="string", length=254, nullable=true)
- */
- private $googleId;
- /**
- * @var string
- *
- * @ORM\Column(name="facebook_id", type="string", length=254, nullable=true)
- */
- private $facebookId;
- /**
- * @var string
- *
- * @ORM\Column(name="password", type="blob", length=64, nullable=false)
- * @Assert\NotBlank()
- * @Assert\Length(max = 4096)
- */
- protected $password;
- /**
- * @var string
- *
- * @ORM\Column(name="userip", type="string", length=10, nullable=false)
- */
- private $userip;
- /**
- * @var integer
- *
- * @ORM\Column(name="fk_status", type="integer", nullable=false)
- */
- private $fkStatus;
- /**
- * @var integer
- *
- * @ORM\Column(name="fk_profileid", type="integer", nullable=false)
- */
- private $fkProfileid;
- /**
- * @var string
- *
- * @ORM\Column(name="username", type="string", length=25, nullable=true)
- * @Assert\NotBlank(groups={"registration"})
- */
- private $username;
- /**
- * @var string
- *
- * @ORM\Column(name="loginid", type="string", length=254, nullable=false)
- */
- private $loginid;
- /**
- * @var string
- *
- * @ORM\Column(name="confirmation", type="string", length=64, nullable=true)
- */
- private $confirmation;
- /**
- * @var string
- *
- * @ORM\Column(name="pwdexpiredtoken", type="string", length=64, nullable=true)
- */
- private $pwdexpiredtoken;
- /**
- * @var integer
- *
- * @ORM\Column(name="pwdexpired", type="integer", nullable=true)
- */
- private $pwdexpired;
- /**
- * @var \DateTime
- *
- * @ORM\Column(name="deleted_at", type="datetime", nullable=true)
- */
- private $deletedAt;
- /**
- * @var integer
- *
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="IDENTITY")
- */
- protected $id;
- /**
- * @ORM\Column(name="is_active", type="boolean")
- */
- private $isActive;
- /**
- * @ORM\ManyToMany(targetEntity="TblPrivilege", inversedBy="users")
- * @ORM\JoinTable(name="tbl_user_privilege",
- joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
- inverseJoinColumns={@ORM\JoinColumn(name="privilege_id", referencedColumnName="id")})
- */
- private $roles;
- public function __construct()
- {
- $this->isActive = true;
- $this->roles = new ArrayCollection(array('ROLE_USER'));
- }
- public function getRoles()
- {
- return $this->roles->toArray();
- }
- /**
- * @inheritDoc
- */
- public function getSalt()
- {
- // Returns null because we are using bcrypt password encoding
- return null;
- }
- /**
- * Set email
- *
- * @param string $email
- * @return TblUser
- */
- public function setEmail($email)
- {
- $this->email = $email;
- return $this;
- }
- /**
- * Get email
- *
- * @return string
- */
- public function getEmail()
- {
- return $this->email;
- }
- /**
- * Get created
- *
- * @return datetime
- */
- public function getCreatedAt()
- {
- return $this->createdAt;
- }
- /**
- * Get modified
- *
- * @return datetime
- */
- public function getModifiedAt()
- {
- return $this->modifiedAt;
- }
- /**
- * Set lastLogin
- *
- * @param \DateTime $lastLogin
- * @return TblUser
- */
- public function setLastLogin(DateTime $time = NULL)
- {
- $this->lastLogin = $lastLogin;
- return $this;
- }
- /**
- * Get lastLogin
- *
- * @return \DateTime
- */
- public function getLastLogin()
- {
- return $this->lastLogin;
- }
- /**
- * Set googleId
- *
- * @param string $googleId
- * @return TblUser
- */
- public function setGoogleId($googleId)
- {
- $this->googleId = $googleId;
- return $this;
- }
- /**
- * Get googleId
- *
- * @return string
- */
- public function getGoogleId()
- {
- return $this->googleId;
- }
- /**
- * Set facebookId
- *
- * @param string $facebookId
- * @return TblUser
- */
- public function setFacebookId($facebookId)
- {
- $this->facebookId = $facebookId;
- return $this;
- }
- /**
- * Get facebookId
- *
- * @return string
- */
- public function getFacebookId()
- {
- return $this->facebookId;
- }
- /**
- * Set password
- *
- * @param string $password
- * @return TblUser
- */
- public function setPassword($password)
- {
- $this->password = $password;
- return $this;
- }
- /**
- * Get password
- *
- * @return string
- */
- public function getPassword()
- {
- return $this->password;
- }
- /**
- * Set userip
- *
- * @param string $userip
- * @return TblUser
- */
- public function setUserip($userip)
- {
- $this->userip = $userip;
- return $this;
- }
- /**
- * Get userip
- *
- * @return string
- */
- public function getUserip()
- {
- return $this->userip;
- }
- /**
- * Set fkStatus
- *
- * @param integer $fkStatus
- * @return TblUser
- */
- public function setFkStatus($fkStatus)
- {
- $this->fkStatus = $fkStatus;
- return $this;
- }
- /**
- * Get fkStatus
- *
- * @return integer
- */
- public function getFkStatus()
- {
- return $this->fkStatus;
- }
- /**
- * Set fkProfileid
- *
- * @param integer $fkProfileid
- * @return TblUser
- */
- public function setFkProfileid($fkProfileid)
- {
- $this->fkProfileid = $fkProfileid;
- return $this;
- }
- /**
- * Get fkProfileid
- *
- * @return integer
- */
- public function getFkProfileid()
- {
- return $this->fkProfileid;
- }
- /**
- * Set username
- *
- * @param string $username
- * @return TblUser
- */
- public function setUsername($username)
- {
- $this->username = $username;
- return $this;
- }
- /**
- * Get username
- *
- * @return string
- */
- public function getUsername()
- {
- return $this->username;
- }
- /**
- * Set deletedAt
- *
- * @param \DateTime $deletedAt
- * @return TblUser
- */
- public function setDeletedAt($deletedAt)
- {
- $this->deletedAt = $deletedAt;
- return $this;
- }
- /**
- * Get deletedAt
- *
- * @return \DateTime
- */
- public function getDeletedAt()
- {
- return $this->deletedAt;
- }
- /**
- * Get id
- *
- * @return string
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Get status id as string
- *
- * @return string
- */
- public function __toString() { return (string)$this->id; }
- /**
- * @inheritDoc
- */
- public function eraseCredentials()
- {
- }
- /**
- * @see \Serializable::serialize()
- */
- public function serialize()
- {
- return serialize(array(
- $this->id,
- $this->username,
- $this->password,
- $this->isActive,
- // see section on salt below
- // $this->salt,
- ));
- }
- /**
- * @see \Serializable::unserialize()
- */
- public function unserialize($serialized)
- {
- list (
- $this->id,
- $this->username,
- $this->password,
- $this->isActive,
- // see section on salt below
- // $this->salt
- ) = unserialize($serialized);
- }
- public function isAccountNonExpired()
- {
- return true;
- }
- public function isAccountNonLocked()
- {
- return true;
- }
- public function isCredentialsNonExpired()
- {
- return true;
- }
- public function isEnabled()
- {
- return $this->isActive;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement