Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace RedK\Core\IndexBundle\Entity;
- use Assetic\Asset\StringAsset;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- use Doctrine\ORM\Mapping\InheritanceType;
- use Symfony\Component\Security\Core\User\UserInterface;
- use Symfony\Component\Security\Core\User\AdvancedUserInterface;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * RedK\Core\IndexBundle\Entity\Accounts
- *
- * @ORM\Table(name="accounts")
- * @ORM\Entity(repositoryClass="RedK\Core\IndexBundle\Entity\AccountsRepository")
- */
- class Accounts implements AdvancedUserInterface
- {
- /**
- * @var integer $accountsID
- *
- * @ORM\Column(name="AccountsID", type="integer", nullable=false)
- * @ORM\Id()
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $accountsID;
- /**
- * @var string $activationKey
- *
- * @ORM\Column(name="ActivationKey", type="string", length=32, nullable=true)
- */
- private $activationKey;
- /**
- * @var string $accountStatus
- *
- * @ORM\Column(name="AccountStatus", type="string", length=10, nullable=false)
- */
- private $accountStatus;
- /**
- * @var integer $organizationID
- *
- * @ORM\Column(name="OrganizationID", type="integer", nullable=true)
- */
- private $organizationID;
- /**
- * @var string $type
- *
- * @ORM\Column(name="Type", type="string", length=2, nullable=true)
- */
- private $type;
- /**
- * @var string $firstName
- *
- * @ORM\Column(name="FirstName", type="string", length=100, nullable=false)
- * @Assert\NotBlank()
- * @Assert\Regex(pattern="/\d+/", match=false, message="First Name is invalid")
- */
- private $firstName;
- /**
- * @var string $lastName
- *
- * @ORM\Column(name="LastName", type="string", length=100, nullable=false)
- * @Assert\NotBlank()
- * @Assert\Regex(pattern="/\d+/", match=false, message="Last Name is invalid")
- */
- private $lastName;
- /**
- * @var string $email
- *
- * @ORM\Column(name="Email", type="string", length=100, nullable=false)
- * @Assert\NotBlank(groups={"recovery", "Default"})
- * @Assert\Email(groups={"recovery", "Default"})
- */
- private $email;
- /**
- * @var string $password
- *
- * @ORM\Column(name="Password", type="string", length=255, nullable=false)
- * @Assert\NotBlank(groups={"reset", "Default"})
- * @Assert\MinLength(limit=8, groups={"reset", "Default"})
- * @Assert\MaxLength(limit=24, groups={"reset", "Default"})
- */
- private $password;
- /**
- * @var string $salt
- *
- * @ORM\Column(name="Salt", type="string", length=32, nullable=false)
- */
- private $salt;
- /**
- * @var string $passwordResetKey
- *
- * @ORM\Column(name="PasswordResetKey", type="string", length=24, nullable=true)
- */
- private $passwordResetKey;
- /**
- * @var datetime $passwordResetStamp
- *
- * @ORM\Column(name="PasswordResetStamp", type="datetime", nullable=true)
- */
- private $passwordResetStamp;
- /**
- * @var string $notifyEmail
- *
- * @ORM\Column(name="NotifyEmail", type="string", length=10, nullable=true)
- */
- private $notifyEmail;
- /**
- * @var datetime $lastVisit
- *
- * @ORM\Column(name="LastVisit", type="datetime", nullable=true)
- */
- private $lastVisit;
- /**
- * @var datetime $addStamp
- *
- * @ORM\Column(name="AddStamp", type="datetime", nullable=false)
- */
- private $addStamp;
- /**
- * @var string $emailVerify
- * @Assert\NotBlank()
- * @Assert\Email
- */
- private $emailVerify;
- /**
- * @var string $passwordVerify
- * @Assert\NotBlank(groups={"reset", "Default"})
- * @Assert\MinLength(limit=8, groups={"reset", "Default"})
- * @Assert\MaxLength(limit=24, groups={"reset", "Default"})
- */
- private $passwordVerify;
- /**
- * @ORM\ManyToMany(targetEntity="AccountsRoles", inversedBy="users")
- */
- private $groups;
- /**
- * Get accountsID
- *
- * @return integer
- */
- public function getAccountsID()
- {
- return $this->accountsID;
- }
- /**
- * Set activationKey
- *
- * @param string $activationKey
- */
- public function setActivationKey($activationKey)
- {
- $this->activationKey = $activationKey;
- }
- /**
- * Get activationKey
- *
- * @return string
- */
- public function getActivationKey()
- {
- return $this->activationKey;
- }
- /**
- * Set accountStatus
- *
- * @param string $accountStatus
- */
- public function setAccountStatus($accountStatus)
- {
- $this->accountStatus = $accountStatus;
- }
- /**
- * Get accountStatus
- *
- * @return string
- */
- public function getAccountStatus()
- {
- return $this->accountStatus;
- }
- /**
- * Set organizationID
- *
- * @param integer $organizationID
- */
- public function setOrganizationID($organizationID)
- {
- $this->organizationID = $organizationID;
- }
- /**
- * Get organizationID
- *
- * @return integer
- */
- public function getOrganizationID()
- {
- return $this->organizationID;
- }
- /**
- * Set type
- *
- * @param string $type
- */
- public function setType($type)
- {
- $this->type = $type;
- }
- /**
- * Get type
- *
- * @return string
- */
- public function getType()
- {
- return $this->type;
- }
- /**
- * Set firstname
- *
- * @param string $firstName
- */
- public function setFirstName($firstName)
- {
- $this->firstName = $firstName;
- }
- /**
- * Get firstName
- *
- * @return string
- */
- public function getFirstName()
- {
- return $this->firstName;
- }
- /**
- * Set lastName
- *
- * @param string $lastName
- */
- public function setLastName($lastName)
- {
- $this->lastName = $lastName;
- }
- /**
- * Get lastName
- *
- * @return string
- */
- public function getLastName()
- {
- return $this->lastName;
- }
- /**
- * Set email
- *
- * @param string $email
- */
- public function setEmail($email)
- {
- $this->email = $email;
- }
- /**
- * Get email
- *
- * @return string
- */
- public function getEmail()
- {
- return $this->email;
- }
- /**
- * Set password
- *
- * @param string $password
- */
- public function setPassword($password)
- {
- $this->password = $password;
- }
- /**
- * Get password
- *
- * @return string
- */
- public function getPassword()
- {
- return $this->password;
- }
- /**
- * Set salt
- *
- * @param string $salt
- */
- public function setSalt($salt)
- {
- $this->salt = $salt;
- }
- /**
- * Get salt
- *
- * @return string
- */
- public function getSalt()
- {
- return $this->salt;
- }
- /**
- * Set passwordResetKey
- *
- * @param string $passwordResetKey
- */
- public function setPasswordResetKey($passwordResetKey)
- {
- $this->passwordResetKey = $passwordResetKey;
- }
- /**
- * Get passwordResetKey
- *
- * @return string
- */
- public function getPasswordResetKey()
- {
- return $this->passwordResetKey;
- }
- /**
- * Set passwordResetStamp
- *
- * @param datetime $passwordResetStamp
- */
- public function setPasswordResetStamp($passwordResetStamp)
- {
- $this->passwordResetStamp = $passwordResetStamp;
- }
- /**
- * Get passwordResetStamp
- *
- * @return datetime
- */
- public function getPasswordResetStamp()
- {
- return $this->passwordResetStamp;
- }
- /**
- * Set notifyEmail
- *
- * @param string $notifyEmail
- */
- public function setNotifyEmail($notifyEmail)
- {
- $this->notifyEmail = $notifyEmail;
- }
- /**
- * Get notifyEmail
- *
- * @return string
- */
- public function getNotifyEmail()
- {
- return $this->notifyEmail;
- }
- /**
- * Set lastVisit
- *
- * @param datetime $lastVisit
- */
- public function setLastVisit($lastVisit)
- {
- $this->lastVisit = $lastVisit;
- }
- /**
- * Get lastVisit
- *
- * @return datetime
- */
- public function getLastVisit()
- {
- return $this->lastVisit;
- }
- /**
- * Set addStamp
- *
- * @param datetime $addStamp
- */
- public function setAddStamp($addStamp)
- {
- $this->addStamp = $addStamp;
- }
- /**
- * Get addStamp
- *
- * @return datetime
- */
- public function getAddStamp()
- {
- return $this->addStamp;
- }
- /**
- * Get emailVerify
- */
- public function getEmailVerify()
- {
- return $this->emailVerify;
- }
- /**
- * Set emailVerify
- */
- public function setEmailVerify($emailVerify)
- {
- return $this->emailVerify = $emailVerify;
- }
- /**
- * Get passwordVerify
- */
- public function getPasswordVerify()
- {
- return $this->passwordVerify;
- }
- /**
- * Set passwordVerify
- */
- public function setPasswordVerify($passwordVerify)
- {
- return $this->passwordVerify = $passwordVerify;
- }
- /**
- *
- */
- public function __construct()
- {
- $this->accountStatus = '18.100.009';
- $this->salt = md5(uniqid(null, true));
- $this->addStamp = new \DateTime("now");
- $this->groups = new ArrayCollection();
- }
- /**
- * @inheritDoc
- */
- public function getUsername()
- {
- return $this->email;
- }
- /**
- * @inheritDoc
- */
- public function getRoles()
- {
- //return array('ROLE_USER');
- return $this->groups->toArray();
- }
- /**
- * @inheritDoc
- */
- public function eraseCredentials()
- {
- }
- public function isAccountNonExpired()
- {
- return true;
- }
- public function isAccountNonLocked()
- {
- return true;
- }
- public function isCredentialsNonExpired()
- {
- return true;
- }
- public function isEnabled()
- {
- if ($this->getAccountStatus() == '18.100.010') {
- return true;
- }
- return false;
- }
- /**
- * @inheritDoc
- */
- public function equals(UserInterface $user)
- {
- return $this->email === $user->getUsername();
- }
- /**
- * @Assert\True(message="Email Address and Verify Email Address values do not match")
- */
- public function isEmailVerified()
- {
- return $this->email === $this->emailVerify;
- }
- /**
- * @Assert\True(message="Password and Verify Password values do not match", groups={"reset", "Default"})
- */
- public function isPasswordVerified()
- {
- return $this->password === $this->passwordVerify;
- }
- /**
- * Get groups
- *
- * @return string
- */
- public function getGroups()
- {
- return $this->groups;
- }
- /**
- * Set groups
- *
- * @param string $groups
- */
- public function setGroups($groups)
- {
- $this->groups = $groups;
- }
- }
Add Comment
Please, Sign In to add comment