| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363 |
- <?php
- namespace AppBundle\Entity\AccessWish;
- use AppBundle\Entity\Organization\Organization;
- use AppBundle\Entity\Traits\TimestampableEntity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * Contient les access temporaires d'une organisation = les email qui ont fait la procédure signin
- */
- #[ORM\Entity]
- class AccessTmp
- {
- use TimestampableEntity;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- private $id;
- /**
- * @var Organization
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization')]
- private $organization;
- /**
- * @var string
- */
- #[Assert\Type(type: 'string')]
- #[ORM\Column(type: 'string', nullable: true)]
- private $mail;
- /**
- * @var string
- */
- #[Assert\Type(type: 'string')]
- #[ORM\Column(type: 'string', nullable: true)]
- private $username;
- /**
- * @var string
- */
- #[Assert\Type(type: 'string')]
- #[ORM\Column(type: 'string', nullable: true)]
- private $password;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', length: 100, nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Assert\Length(max: 100, maxMessage: 'invalid-max-length')]
- private $name;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', length: 50, nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Assert\Length(max: 50, maxMessage: 'invalid-max-length')]
- private $givenName;
- /**
- * @var \DateTime Date of birth.
- */
- #[ORM\Column(type: 'date', nullable: true)]
- #[Assert\Date(message: 'invalid-date')]
- private $birthDate;
- /**
- * @var bool
- */
- #[ORM\Column(type: 'boolean', options: ['default' => false])]
- #[Assert\Type(type: 'boolean')]
- #[Assert\NotNull]
- private $informationRetainedAndUsed = false;
- /**
- * @var bool
- */
- #[ORM\Column(type: 'boolean', options: ['default' => false])]
- #[Assert\Type(type: 'boolean')]
- #[Assert\NotNull]
- private $cgu = false;
- /**
- * Random string sent to the user email address in order to verify it
- *
- * @var string
- */
- #[ORM\Column(name: 'confirmation_token', type: 'string', nullable: false)]
- private $confirmationToken;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'datetime', nullable: false)]
- private $tokenGivenDate;
- public function __construct()
- {
- }
- /**
- * Sets id.
- *
- * @param int $id
- *
- * @return $this
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * Gets id.
- *
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Sets organization.
- *
- * @param Organization $organization
- *
- * @return $this
- */
- public function setOrganization(Organization $organization = null)
- {
- $this->organization = $organization;
- return $this;
- }
- /**
- * Gets organization.
- *
- * @return Organization
- */
- public function getOrganization()
- {
- return $this->organization;
- }
- /**
- * Sets mail.
- *
- * @param string $mail
- *
- * @return $this
- */
- public function setMail($mail)
- {
- $this->mail = $mail;
- return $this;
- }
- /**
- * Gets mail.
- *
- * @return string
- */
- public function getMail()
- {
- return $this->mail;
- }
- /**
- * Sets username.
- *
- * @param string $username
- *
- * @return $this
- */
- public function setUsername($username)
- {
- $this->username = $username;
- return $this;
- }
- /**
- * Gets username.
- *
- * @return string
- */
- public function getUsername()
- {
- return $this->username;
- }
- /**
- * Sets password.
- *
- * @param string $password
- *
- * @return $this
- */
- public function setPassword($password)
- {
- $this->password = $password;
- return $this;
- }
- /**
- * Gets password.
- *
- * @return string
- */
- public function getPassword()
- {
- return $this->password;
- }
- /**
- * Sets confirmation token.
- *
- * @param string $token
- *
- * @return $this
- */
- public function setConfirmationToken($token)
- {
- $this->confirmationToken = $token;
- return $this;
- }
- /**
- * Gets confirmation token.
- *
- * @return string
- */
- public function getConfirmationToken()
- {
- return $this->confirmationToken;
- }
- /**
- * set token given date
- * @param \DateTime $tokenGivenDate
- * @return $this
- */
- public function setTokenGivenDate(\DateTime $tokenGivenDate)
- {
- $this->tokenGivenDate = $tokenGivenDate;
- return $this;
- }
- /**
- * Gets token given date
- *
- * @return \DateTime
- */
- public function getTokenGivenDate()
- {
- return $this->tokenGivenDate;
- }
- public function isTokenNonExpired($ttl)
- {
- return $this->getTokenGivenDate() instanceof \DateTime &&
- $this->getTokenGivenDate()->getTimestamp() + $ttl > time();
- }
- /**
- * Set name
- *
- * @param string $name
- *
- * @return AccessTmp
- */
- public function setName($name)
- {
- $this->name = $name;
- return $this;
- }
- /**
- * Get name
- *
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * Set givenName
- *
- * @param string $givenName
- *
- * @return AccessTmp
- */
- public function setGivenName($givenName)
- {
- $this->givenName = $givenName;
- return $this;
- }
- /**
- * Get givenName
- *
- * @return string
- */
- public function getGivenName()
- {
- return $this->givenName;
- }
- /**
- * Set birthDate
- *
- * @param \DateTime $birthDate
- *
- * @return AccessTmp
- */
- public function setBirthDate($birthDate)
- {
- $this->birthDate = $birthDate;
- return $this;
- }
- /**
- * Get birthDate
- *
- * @return \DateTime
- */
- public function getBirthDate()
- {
- return $this->birthDate;
- }
- /**
- * Set informationRetainedAndUsed
- *
- * @param boolean $informationRetainedAndUsed
- *
- * @return AccessTmp
- */
- public function setInformationRetainedAndUsed($informationRetainedAndUsed)
- {
- $this->informationRetainedAndUsed = $informationRetainedAndUsed;
- return $this;
- }
- /**
- * Get informationRetainedAndUsed
- *
- * @return boolean
- */
- public function getInformationRetainedAndUsed()
- {
- return $this->informationRetainedAndUsed;
- }
- /**
- * Set cgu
- *
- * @param boolean $cgu
- *
- * @return AccessTmp
- */
- public function setCgu($cgu)
- {
- $this->cgu = $cgu;
- return $this;
- }
- /**
- * Get cgu
- *
- * @return boolean
- */
- public function getCgu()
- {
- return $this->cgu;
- }
- }
|