src/Entity/Users/User.php line 34

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Users;
  3. use App\Model\TimestampableTrait;
  4. use Bo\StudentBundle\Entity\OfferStudent;
  5. use App\Entity\Users\Child as Student;
  6. use Bo\SubscriptionBundle\Entity\OfferHistory;
  7. use App\Validator\Constraints as UserAssert;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use ED\BlogBundle\Interfaces\Model\ArticleCommenterInterface;
  11. use ED\BlogBundle\Interfaces\Model\BlogUserInterface;
  12. use Exception;
  13. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  14. use Symfony\Component\Security\Core\User\EquatableInterface;
  15. use Symfony\Component\Security\Core\User\UserInterface;
  16. use Symfony\Component\Serializer\Annotation\Groups;
  17. use Symfony\Component\Serializer\SerializerInterface;
  18. use Symfony\Component\Validator\Constraints as Assert;
  19. use Symfony\Component\Yaml\Parser;
  20. // * @UniqueEntity(fields={"email"},message="blabli") @UniqueEntity(fields={"username"})
  21. /**
  22.  * @ORM\Entity(repositoryClass="App\Repository\Users\UserRepository")
  23.  * @ORM\Table(name="aba_user",uniqueConstraints={@ORM\UniqueConstraint(columns={"email"})})
  24.  * @ORM\InheritanceType("SINGLE_TABLE")
  25.  * @ORM\DiscriminatorColumn(name="discr", type="string")
  26.  * @ORM\DiscriminatorMap({"user"="User","parents"="Parents","teacher"="Teacher","admin"="Admin","student"="Child","guardiant"="Guardiant"})
  27.  * @ORM\HasLifecycleCallbacks()
  28.  * @UniqueEntity(fields={"email"},repositoryMethod="findByUniqueCriteria",message="Cet email est déjà utilisé")
  29.  *
  30.  */
  31. //class User extends BaseUser implements BlogUserInterface, ArticleCommenterInterface, NotifiableInterface
  32. class User implements UserInterface,EquatableInterface
  33. {
  34.     const ID_LAURENCE = 212828;
  35.     const CIVILITY_MR = 'mr';
  36.     const CIVILITY_MRS = 'mrs';
  37.     const CIVILITY_MISS = 'miss';
  38.     const GENDER_MALE = 'male';
  39.     const GENDER_FEMALE = 'female';
  40.     const PROFIL_ELEVE = 'eleve';
  41.     const PROFIL_PARENT = 'parent';
  42.     const DISCR_PARENT = 'parents';
  43.     const DISCR_STUDENT = 'student';
  44.     const ORIGIN_SITE = 1;
  45.     const ORIGIN_MOBILE = 2;
  46.     use TimestampableTrait;
  47.     /**
  48.      * @ORM\Id
  49.      * @ORM\Column(type="integer")
  50.      * @ORM\GeneratedValue(strategy="AUTO")
  51.      * @Groups({"api"})
  52.      */
  53.     protected $id;
  54.     /**
  55.      * Required by BlogUserInterface
  56.      *
  57.      * @ORM\Column(name="blog_display_name", type="string",nullable=true)
  58.      */
  59.     protected $blogDisplayName;
  60.     /**
  61.      * @var string $firstname
  62.      *
  63.      * @ORM\Column(name="firstname", type="string", length=255, nullable=false)
  64.      * @Assert\NotBlank(message="Vous devez renseigner votre prénom")
  65.      * @Groups({"api"})
  66.      */
  67.     protected $firstname;
  68.     /**
  69.      * @ORM\Column(name="gender", type="string", nullable=true)
  70.      * Assert\NotBlank(message="Vous devez renseigner votre genre")
  71.      */
  72.     protected $gender;
  73.     /**
  74.      * @var string
  75.      * @ORM\Column(name="registration_profile", nullable=true, type="string")
  76.      * Assert\NotBlank(message="Vous devez renseigner votre profil")
  77.      */
  78.     private $registrationProfile;
  79.     /**
  80.      * @ORM\Column(name="civility", type="string", nullable=true)
  81.      * @Groups({"api"})
  82.      */
  83.     protected $civility;
  84.     /**
  85.      * @ORM\Column(name="email", type="string",unique=true)
  86.      * @Assert\Email(message = "Merci d'indiquer un email valide.")
  87.      *
  88.      * @Groups({"api"})
  89.      */
  90.     protected $email;
  91. //@Assert\Email
  92.     /**
  93.      * @ORM\Column(type="string",nullable=true)
  94.      *
  95.      */
  96.     protected $username;
  97.     /**
  98.      * @ORM\Column(type="boolean",nullable=true)
  99.      */
  100.     protected $enabled;
  101.     /**
  102.      * The salt to use for hashing.
  103.      *
  104.      * @ORM\Column(type="string",nullable=true)
  105.      */
  106.     protected $salt;
  107.     /**
  108.      * Encrypted password. Must be persisted.
  109.      *
  110.      * @ORM\Column(type="string")
  111.      */
  112.     protected $password;
  113.     /**
  114.      * @ORM\Column(type="CustomJsonType")
  115.      */
  116.     protected $roles = [];
  117.     /**
  118.      *
  119.      * @Assert\NotBlank(groups={"registration"})
  120.      */
  121.     protected $plainPassword;
  122.     /**
  123.      * @var \DateTime|null
  124.      */
  125.     protected $lastLogin;
  126.     /**
  127.      * @var string $lastname
  128.      *
  129.      * @ORM\Column(name="lastname", type="string", length=255, nullable=true)
  130.      *
  131.      * @Groups({"api"})
  132.      */
  133.     protected $lastname;
  134.     /**
  135.      * @var string $promoCode
  136.      *
  137.      * @ORM\Column(name="promo_code", type="string", length=255, nullable=true)
  138.      *
  139.      */
  140.     protected $promoCode;
  141.     /**
  142.      * @var integer $endSubscriptionMailSended
  143.      *
  144.      * @ORM\Column(name="end_subscription_mail_sended", type="integer")
  145.      */
  146.     protected $endSubscriptionMailSended = 0;
  147.     /**
  148.      * @var integer
  149.      *
  150.      * @ORM\Column(name="email_validation", type="integer")
  151.      */
  152.     protected $emailValidation = 0;
  153.     /**
  154.      * @var string
  155.      *
  156.      * @ORM\Column(name="email_validation_token", type="string")
  157.      */
  158.     protected $emailValidationToken;
  159.     /**
  160.      * @var string
  161.      *
  162.      * @ORM\Column(name="email_validation_token_requested_at", type="datetime")
  163.      */
  164.     protected $emailValidationTokenRequestedAt;
  165.     /**
  166.      * @var string $facebookId
  167.      *
  168.      * @ORM\Column(name="facebook_id", type="string", length=255, nullable=true)
  169.      *
  170.      */
  171.     protected $facebookId;
  172.     /**
  173.      * @var string $facebookAccessToken1
  174.      *
  175.      * @ORM\Column(name="facebook_access_token", type="string", length=255, nullable=true)
  176.      *
  177.      */
  178.     protected $facebookAccessToken;
  179.     /**
  180.      * @var string $profilePicture
  181.      *
  182.      * @ORM\Column(name="profile_picture", type="string", length=255, nullable=true)
  183.      */
  184.     protected $profilePicture;
  185.     /**
  186.      * @var
  187.      */
  188.     protected $customRoles;
  189.     /**
  190.      * @var string $promoCode
  191.      *
  192.      * @ORM\Column(name="encoding_mdp", type="boolean", nullable=true)
  193.      */
  194.     protected $encodingMdp;
  195.     /**
  196.      * @var boolean
  197.      * @ORM\Column(name="notif",type="boolean",nullable=true)
  198.      */
  199.     protected $notif;
  200.     /**
  201.      * @var string
  202.      * @Assert\File(maxSize = "5M")
  203.      */
  204.     protected $picture;
  205.     /**
  206.      * @var string
  207.      * @ORM\Column(name="picture", type="string", length=255, nullable=true)
  208.      */
  209.     protected $path;
  210.     /**
  211.      * @var boolean
  212.      * @ORM\Column(name="credit_card",type="boolean",nullable=true)
  213.      */
  214.     protected $creditCard;
  215.     /*
  216.      * @ORM\OneToMany(targetEntity="\Bo\StudentBundle\Entity\OfferStudent",mappedBy="student")
  217.      *
  218.      */
  219.     protected $offers;
  220.     /*
  221.      * @ORM\OneToMany(targetEntity="\Bo\ReportBundle\Entity\Report",mappedBy="user")
  222.      */
  223.     protected $reports;
  224.     /**
  225.      * @ORM\Column(name="is_newsletter",type="boolean",nullable=true)
  226.      */
  227.     protected $isNewsletter;
  228.     /**
  229.      * @ORM\Column(name="is_cgu",type="boolean")
  230.      *
  231.      */
  232.     protected $isCgu;
  233.     /**
  234.      * @ORM\Column(name="popin_share_good_deal", type="boolean")
  235.      *
  236.      */
  237.     protected $popinShareGoodDeal;
  238.     /**
  239.      * @ORM\Column(name="stripe_id",type="string",nullable=true,length=255)
  240.      *
  241.      */
  242.     protected $stripeId;
  243.     /**
  244.      * @ORM\Column(name="is_first_connection",type="boolean", options={"default":"1"})
  245.      *
  246.      */
  247.     protected $isFirstConnection;
  248.     /*
  249.      * @ORM\OneToMany(targetEntity="\Bo\AdministratorsBundle\Entity\Assessment", mappedBy="student")
  250.      */
  251.     protected $assessments;
  252.     /*
  253.      * @var OfferHistory
  254.      * @ORM\ManyToOne(targetEntity="Bo\SubscriptionBundle\Entity\OfferHistory", cascade={"persist"})
  255.      */
  256.     protected $latestActiveOfferHistory;
  257.     /**
  258.      * @var int
  259.      * @ORM\Column(type="integer", options={"default":0})
  260.      */
  261.     protected $status;
  262.     /**
  263.      * @var \DateTime
  264.      * @ORM\Column(name="date_sychronisation_intercom",type="datetime",nullable=true)
  265.      */
  266.     protected $dateSychronisationIntercom;
  267.     /**
  268.      * @var integer $origin
  269.      *
  270.      * @ORM\Column(name="origin", type="integer")
  271.      */
  272.     protected $origin;
  273.     /**
  274.      * @var boolean $legal_guardian_authorization
  275.      *
  276.      * @ORM\Column(name="legal_guardian_authorization", type="boolean")
  277.      */
  278.     protected $legalGuardianAuthorization;
  279.     /**
  280.      * @var integer $parentEmail
  281.      * @Groups({"api"})
  282.      * @ORM\Column(name="parent_email", type="string")
  283.      */
  284.     protected $parentEmail;
  285.     /**
  286.      * @var string $avatar
  287.      *
  288.      * @ORM\Column(type="string",nullable=true)
  289.      */
  290.     protected $avatar;
  291.     /**
  292.      * @var boolean $isVerified
  293.      *
  294.      * @ORM\Column(type="boolean",nullable=true)
  295.      */
  296.     protected $isVerified = false;
  297.     public $fileAvatar;
  298.     /**
  299.      * User constructor.
  300.      */
  301.     public function __construct()
  302.     {
  303.         $this->encodingMdp = true;
  304.         $this->notif = false;
  305.         $this->username = $this->email;
  306.         $this->offers = new ArrayCollection();
  307.         $this->reports = new ArrayCollection();
  308.         $this->isFirstConnection = true;
  309.         $this->isNewsletter = false;
  310.         $this->isCgu = false;
  311.         $this->isFirstConnection = true;
  312.         $this->newDashboardWelcomeMessage = true;
  313.         //$this->status = OfferHistory::STATUS_NO_OFFER;
  314.     }
  315.     /**
  316.      * Return all the civilities
  317.      * @return array
  318.      */
  319.     public static function getCivilities()
  320.     {
  321.         return [self::CIVILITY_MR, self::CIVILITY_MISS, self::CIVILITY_MRS];
  322.     }
  323.     /**
  324.      * @deprecated To remove when everything will good
  325.      * @return string
  326.      */
  327.     public function getHistoryWording()
  328.     {
  329.         $res = "Inscrit sans abonnement";
  330.         if ($this->status != OfferHistory::STATUS_NO_OFFER && $this->getLatestActiveOfferHistory()) {
  331.             $res = $this->getLatestActiveOfferHistory()->getWording();
  332.         }
  333.         return $res;
  334.     }
  335.     /**
  336.      * @deprecated To remove when everything will good
  337.      * @return OfferHistory
  338.      */
  339.     public function getLatestActiveOfferHistory()
  340.     {
  341.         return $this->latestActiveOfferHistory;
  342.     }
  343.     /**
  344.      * @deprecated To remove when everything will good
  345.      * @param OfferHistory|null $latestActiveOfferHistory
  346.      */
  347.     public function setLatestActiveOfferHistory($latestActiveOfferHistory)
  348.     {
  349.         $this->latestActiveOfferHistory = $latestActiveOfferHistory;
  350.         if ($latestActiveOfferHistory) {
  351.             $this->setStatus($latestActiveOfferHistory->getStatus());
  352.         } else {
  353.             $this->setStatus(OfferHistory::STATUS_NO_OFFER);
  354.         }
  355.     }
  356.     /**
  357.      * @deprecated To remove when everything will good
  358.      * @return int
  359.      */
  360.     public function getStatus()
  361.     {
  362.         if ($this->latestActiveOfferHistory) {
  363.             return $this->latestActiveOfferHistory->getStatus();
  364.         }
  365.         return $this->status;
  366.     }
  367.     /**
  368.      * @param int $status
  369.      */
  370.     public function setStatus(int $status)
  371.     {
  372.         $this->status = $status;
  373.     }
  374.     /**
  375.      * @return mixed
  376.      */
  377.     public function getBlogDisplayName()
  378.     {
  379.         return $this->blogDisplayName;
  380.     }
  381.     /**
  382.      * @param $blogDisplayName
  383.      * @return $this
  384.      */
  385.     public function setBlogDisplayName($blogDisplayName)
  386.     {
  387.         $this->blogDisplayName = $blogDisplayName;
  388.         return $this;
  389.     }
  390.     /**
  391.      * @return mixed
  392.      */
  393.     public function getCommenterDisplayName()
  394.     {
  395.         return $this->blogDisplayName;
  396.     }
  397.     /**
  398.      * @return string
  399.      */
  400.     public function getEncodingMdp()
  401.     {
  402.         return $this->encodingMdp;
  403.     }
  404.     /**
  405.      * @param string $encodingMdp
  406.      */
  407.     public function setEncodingMdp($encodingMdp)
  408.     {
  409.         $this->encodingMdp = $encodingMdp;
  410.     }
  411. /*
  412.     public function serialize()
  413.     {
  414.         return serialize(array($this->facebookId, parent::serialize()));
  415.     }
  416.     public function unserialize($data)
  417.     {
  418.         [$this->facebookId, $parentData] = unserialize($data);
  419.         parent::unserialize($parentData);
  420.     }
  421. */
  422.     /**
  423.      * Get id
  424.      *
  425.      * @return integer
  426.      */
  427.     public function getId()
  428.     {
  429.         return $this->id;
  430.     }
  431.     public function setId($id)
  432.     {
  433.         $this->id = $id;
  434.     }
  435.     /**
  436.      * Get Uid
  437.      *
  438.      * @return string
  439.      */
  440.     public function getUid()
  441.     {
  442.         return sha1($this->id);
  443.     }
  444.     /**
  445.      * Set firstname
  446.      *
  447.      * @param string $firstname
  448.      */
  449.     public function setFirstname($firstname)
  450.     {
  451.         $this->firstname = $firstname;
  452.     }
  453.     /**
  454.      * Get firstname
  455.      *
  456.      * @return string
  457.      */
  458.     public function getFirstname()
  459.     {
  460.         return $this->firstname;
  461.     }
  462.     /**
  463.      * Set lastname
  464.      *
  465.      * @param string $lastname
  466.      */
  467.     public function setLastname($lastname)
  468.     {
  469.         $this->lastname = $lastname;
  470.     }
  471.     /**
  472.      * Get lastname
  473.      *
  474.      * @return string
  475.      */
  476.     public function getLastname()
  477.     {
  478.         return $this->lastname;
  479.     }
  480.     public function getFullname()
  481.     {
  482.         return sprintf('%s %s', $this->getFirstname(), $this->getLastname());
  483.     }
  484.     /**
  485.      * @param string $facebookId
  486.      * @return void
  487.      */
  488.     public function setFacebookId($facebookId)
  489.     {
  490.         $this->facebookId = $facebookId;
  491.     }
  492.     /**
  493.      * @return string
  494.      */
  495.     public function getFacebookId()
  496.     {
  497.         return $this->facebookId;
  498.     }
  499.     /**
  500.      * @return string
  501.      */
  502.     public function getFacebookAccessToken()
  503.     {
  504.         return $this->facebookAccessToken;
  505.     }
  506.     /**
  507.      * @param string $facebookAccessToken
  508.      */
  509.     public function setFacebookAccessToken($facebookAccessToken)
  510.     {
  511.         $this->facebookAccessToken = $facebookAccessToken;
  512.     }
  513.     /**
  514.      * @var string $phone
  515.      *
  516.      * @ORM\Column(name="phone", type="string", length=255, nullable=true)
  517.      * @Assert\Length(min = 5, max = 20, minMessage = "Numéro de telephone invalide", maxMessage = "Numéro de telephone invalide")
  518.      *
  519.      * @Groups({"api"})
  520.      */
  521.     protected $phone;
  522.     /**
  523.      * @var string $street
  524.      *
  525.      * @ORM\Column(name="street", type="string", length=255, nullable=true)
  526.      *
  527.      */
  528.     protected $street;
  529.     /**
  530.      * @var string $postalCode
  531.      *
  532.      * @ORM\Column(name="postal_code", type="string", length=255, nullable=true)
  533.      *
  534.      */
  535.     protected $postalCode;
  536.     /**
  537.      * @var string $city
  538.      *
  539.      * @ORM\Column(name="city", type="string", length=255, nullable=true)
  540.      *
  541.      */
  542.     protected $city;
  543.     /**
  544.      * @var string $country
  545.      *
  546.      * @ORM\Column(name="country", type="string", length=255, nullable=true)
  547.      * @Assert\NotBlank(groups={"registration_parent"})
  548.      */
  549.     protected $country;
  550.     /**
  551.      * if the user allow to send promotion mails
  552.      * @var boolean $promo
  553.      *
  554.      * @ORM\Column(name="promo", type="boolean")
  555.      */
  556.     protected $promo = false;
  557.     /**
  558.      * @var boolean $report
  559.      * @todo changeIt
  560.      *
  561.      * @ORM\Column(name="report", type="string", length=255)
  562.      * @Assert\Choice(
  563.      *     callback = {"\aba\UserBundle\Entity\Report", "getPeriodicitiesValidation"},
  564.      *     message = "Choose a valid periodicity.",
  565.      *     groups={"registration_parent"}
  566.      * )
  567.      */
  568.     protected $report = '';
  569.     /**
  570.      * if the user has validated the post registration form
  571.      * @var boolean $postRegistrationFormValidated
  572.      *
  573.      * @ORM\Column(name="post_registration_form_validated", type="boolean")
  574.      */
  575.     protected $postRegistrationFormValidated = false;
  576.     /**
  577.      * @var string $from
  578.      *
  579.      * @ORM\Column(name="_from", type="string", length=255, nullable=true)
  580.      */
  581.     protected $from;
  582.     /**
  583.      * @var boolean $newDashboardWelcomeMessage
  584.      * @ORM\Column(name="new_dashboard_welcome_message", type="boolean")
  585.      */
  586.     private $newDashboardWelcomeMessage;
  587.     /**
  588.      * @return string
  589.      */
  590.     public function getHmac()
  591.     {
  592.         return hash_hmac(
  593.             'sha256',
  594.             $this->id,
  595.             't4MwVPCbdgQXz03YIAL8kJ08O5z2O2vRaWkTcPFU'
  596.         );
  597.     }
  598.     /**
  599.      * Set phone
  600.      *
  601.      * @param string $phone
  602.      */
  603.     public function setPhone($phone)
  604.     {
  605.         $this->phone = $phone;
  606.     }
  607.     /**
  608.      * Get phone
  609.      *
  610.      * @return string
  611.      */
  612.     public function getPhone()
  613.     {
  614.         return $this->phone;
  615.     }
  616.     /**
  617.      * Set street
  618.      *
  619.      * @param string $street
  620.      */
  621.     public function setStreet($street)
  622.     {
  623.         $this->street = $street;
  624.     }
  625.     /**
  626.      * Get street
  627.      *
  628.      * @return string
  629.      */
  630.     public function getStreet()
  631.     {
  632.         return $this->street;
  633.     }
  634.     /**
  635.      * Set postalCode
  636.      *
  637.      * @param string $postalCode
  638.      */
  639.     public function setPostalCode($postalCode)
  640.     {
  641.         $this->postalCode = $postalCode;
  642.     }
  643.     /**
  644.      * Get postalCode
  645.      *
  646.      * @return string
  647.      */
  648.     public function getPostalCode()
  649.     {
  650.         return $this->postalCode;
  651.     }
  652.     /**
  653.      * Set city
  654.      *
  655.      * @param string $city
  656.      */
  657.     public function setCity($city)
  658.     {
  659.         $this->city = $city;
  660.     }
  661.     /**
  662.      * Get city
  663.      *
  664.      * @return string
  665.      */
  666.     public function getCity()
  667.     {
  668.         return $this->city;
  669.     }
  670.     /**
  671.      * Set country
  672.      *
  673.      * @param string $country
  674.      */
  675.     public function setCountry($country)
  676.     {
  677.         $this->country = $country;
  678.     }
  679.     /**
  680.      * Get country
  681.      *
  682.      * @return string
  683.      */
  684.     public function getCountry()
  685.     {
  686.         return $this->country;
  687.     }
  688.     /**
  689.      * Set promo
  690.      *
  691.      * @param boolean $promo
  692.      */
  693.     public function setPromo($promo)
  694.     {
  695.         $this->promo = $promo;
  696.     }
  697.     /**
  698.      * Get promo
  699.      *
  700.      * @return boolean
  701.      */
  702.     public function getPromo()
  703.     {
  704.         return $this->promo;
  705.     }
  706.     /**
  707.      * Set postRegistrationFormValidated
  708.      *
  709.      * @param boolean $postRegistrationFormValidated
  710.      */
  711.     public function setPostRegistrationFormValidated($postRegistrationFormValidated)
  712.     {
  713.         $this->postRegistrationFormValidated = $postRegistrationFormValidated;
  714.     }
  715.     /**
  716.      * Get postRegistrationFormValidated
  717.      *
  718.      * @return boolean
  719.      */
  720.     public function getPostRegistrationFormValidated()
  721.     {
  722.         return $this->postRegistrationFormValidated;
  723.     }
  724.     /**
  725.      * Set promoCode
  726.      *
  727.      * @param string $promoCode
  728.      */
  729.     public function setPromoCode($promoCode)
  730.     {
  731.         $this->promoCode = $promoCode;
  732.     }
  733.     /**
  734.      * Get promoCode
  735.      *
  736.      * @return string
  737.      */
  738.     public function getPromoCode()
  739.     {
  740.         return $this->promoCode;
  741.     }
  742.     /**
  743.      * Set report
  744.      *
  745.      * @param boolean $report
  746.      */
  747.     public function setReport($report)
  748.     {
  749.         $this->report = $report;
  750.     }
  751.     /**
  752.      * Get report
  753.      *
  754.      * @return boolean
  755.      */
  756.     public function getReport()
  757.     {
  758.         return $this->report;
  759.     }
  760.     /**
  761.      * Set from
  762.      *
  763.      * @param string $from
  764.      */
  765.     public function setFrom($from)
  766.     {
  767.         $this->from = $from;
  768.     }
  769.     /**
  770.      * Get from
  771.      *
  772.      * @return string
  773.      */
  774.     public function getFrom()
  775.     {
  776.         return $this->from;
  777.     }
  778.     /**
  779.      * Set course
  780.      *
  781.      * @param Course $course
  782.      */
  783.     public function setCourse($course)
  784.     {
  785.         $this->course = $course;
  786.     }
  787.     /**
  788.      * Get course
  789.      *
  790.      * @return Course
  791.      */
  792.     /**
  793.      * @param string $serie
  794.      */
  795.     public function setSerie($serie)
  796.     {
  797.         $this->serie = $serie;
  798.     }
  799.     /**
  800.      * Set endSubscriptionMailSended
  801.      *
  802.      * @param integer $endSubscriptionMailSended
  803.      */
  804.     public function setEndSubscriptionMailSended($endSubscriptionMailSended)
  805.     {
  806.         $this->endSubscriptionMailSended = $endSubscriptionMailSended;
  807.     }
  808.     /**
  809.      * Get endSubscriptionMailSended
  810.      *
  811.      * @return integer
  812.      */
  813.     public function getEndSubscriptionMailSended()
  814.     {
  815.         return $this->endSubscriptionMailSended;
  816.     }
  817.     /**
  818.      * Return true if the user has ROLE_STUDENT_PAID credential
  819.      * NOT FUNCTIONAL
  820.      */
  821.     public function isParent()
  822.     {
  823.         //return in_array(self::ROLE_PARENT, $this->getRoles());
  824.     }
  825.     /**
  826.      * @return string
  827.      */
  828.     public function getCredentialsExpireAt()
  829.     {
  830.         return $this->credentialsExpireAt;
  831.     }
  832.     /*
  833.      * @param string $credentialsExpireAt
  834.      *
  835.     public function setCredentialsExpireAt($credentialsExpireAt)
  836.     {
  837.         $this->credentialsExpireAt = $credentialsExpireAt;
  838.     }*/
  839.     /**
  840.      * @return mixed
  841.      */
  842.     public function getRoles()
  843.     {
  844.         return $this->roles;
  845.     }
  846.     /**
  847.      * @return mixed
  848.      */
  849.     public function setRoles($roles)
  850.     {
  851.         $this->roles = $roles;
  852.     }
  853.     /**
  854.      * @return mixed
  855.      */
  856.     public function addRoles(string $roles)
  857.     {
  858.         if(!in_array($roles,$this->roles)){
  859.             $this->roles[]= $roles;
  860.         }
  861.     }
  862.     /**
  863.      * @return string
  864.      */
  865.     public function getInstance()
  866.     {
  867.         return $this->customInstanceof();
  868.     }
  869.     /**
  870.      * @return string
  871.      */
  872.     public function customInstanceof()
  873.     {
  874.         if ($this instanceof Teacher) {
  875.             return "teacher";
  876.         }
  877.         if ($this instanceof Student) {
  878.             return "student";
  879.         }
  880.         if ($this instanceof Guardiant) {
  881.             return "guardiant";
  882.         }
  883.         if ($this instanceof Admin) {
  884.             return "admin";
  885.         }
  886.         if ($this instanceof Parents) {
  887.             return "parent";
  888.         }
  889.         return "user";
  890.     }
  891.     static private function convertRoleToLabel($role)
  892.     {
  893.         $roleDisplay = str_replace('ROLE_', '', $role);
  894.         $roleDisplay = str_replace('_', ' ', $roleDisplay);
  895.         return ucwords(strtolower($roleDisplay));
  896.     }
  897.     static function getRoleNames($front = false)
  898.     {
  899.         if (!$front) {
  900.             $pathToSecurity = __DIR__ . '/../../../..' . '/app/config/security.yml';
  901.             $yaml = new Parser();
  902.             $rolesArray = $yaml->parse(file_get_contents($pathToSecurity));
  903.             $arrayKeys = array();
  904.             foreach ($rolesArray['security']['role_hierarchy'] as $key => $value) {
  905.                 //never allow assigning super admin
  906.                 if ($key != 'ROLE_SUPER_ADMIN')
  907.                     $arrayKeys[$key] = User::convertRoleToLabel($key);
  908.                 //skip values that are arrays --- roles with multiple sub-roles
  909.                 if (!is_array($value))
  910.                     if ($value != 'ROLE_SUPER_ADMIN')
  911.                         $arrayKeys[$value] = User::convertRoleToLabel($value);
  912.             }
  913.             //sort for display purposes
  914.             asort($arrayKeys);
  915.             return $arrayKeys;
  916.         }
  917.         return array("" => "select role", "ROLE_STUDENT" => "Eleve", "ROLE_PARENTS" => "Parents");
  918.     }
  919.     /**
  920.      * @ORM\PrePersist()
  921.      * @ORM\PreUpdate()
  922.      */
  923.     public function affectation_disc()
  924.     {
  925.         /* if(!in_array($this->customRoles, $this->roles) && $this->customRoles != null )
  926.          {
  927.              $this->roles[0] = $this->customRoles;
  928.          }*/
  929.     }
  930.     /**
  931.      * @return mixed
  932.      */
  933.     public function getCustomRoles()
  934.     {
  935.         return $this->customRoles;
  936.     }
  937.     /**
  938.      * @param mixed $customRoles
  939.      */
  940.     public function setCustomRoles($customRoles)
  941.     {
  942.         $this->customRoles = $customRoles;
  943.     }
  944.     /**
  945.      * @return bool
  946.      */
  947.     public function flagNotice()
  948.     {
  949.         if ($this instanceof Student) {
  950.             foreach ($this->getParents() as $parent) {
  951.                 if (!$parent->getEnabled()) {
  952.                     return true;
  953.                 }
  954.             }
  955.         }
  956.         return false;
  957.     }
  958.     /**
  959.      * @return mixed
  960.      */
  961.     public function getEmail()
  962.     {
  963.         /*if(preg_match("/@test.com/",$this->email)){
  964.             return '[email protected]';
  965.         }*/
  966.         return $this->email;
  967.     }
  968.     /**
  969.      * @return mixed
  970.      */
  971.     public function getNotif()
  972.     {
  973.         return $this->notif;
  974.     }
  975.     /**
  976.      * @param mixed $notif
  977.      */
  978.     public function setNotif($notif)
  979.     {
  980.         $this->notif = $notif;
  981.     }
  982.     /**
  983.      * @return mixed
  984.      */
  985.     public function getOffers()
  986.     {
  987.         return $this->offers;
  988.     }
  989.     /**
  990.      * @param mixed $offers
  991.      */
  992.     public function setOffers($offers)
  993.     {
  994.         $this->offers = $offers;
  995.     }
  996.     public function addOffers($offers)
  997.     {
  998.         $this->offers[] = $offers;
  999.     }
  1000.     /**
  1001.      * @return mixed
  1002.      */
  1003.     public function getReports()
  1004.     {
  1005.         return $this->reports;
  1006.     }
  1007.     /**
  1008.      * @param mixed $reports
  1009.      */
  1010.     public function setReports($reports)
  1011.     {
  1012.         $this->reports = $reports;
  1013.     }
  1014.     /**
  1015.      * @param mixed $reports
  1016.      */
  1017.     public function addReports($reports)
  1018.     {
  1019.         $this->reports[] = $reports;
  1020.     }
  1021.     /**
  1022.      * @ORM\PrePersist()
  1023.      * @ORM\PreUpdate()
  1024.      */
  1025.     public function prepersist()
  1026.     {
  1027.         $this->username;
  1028.     }
  1029.     public function setEmail($email)
  1030.     {
  1031.         $this->email = $email;
  1032.         $this->username = $email;
  1033.     }
  1034.     /**
  1035.      * @return int
  1036.      */
  1037.     public function getOrigin()
  1038.     {
  1039.         return $this->origin;
  1040.     }
  1041.     /**
  1042.      * @param int $origin
  1043.      */
  1044.     public function setOrigin($origin)
  1045.     {
  1046.         $this->origin = $origin;
  1047.     }
  1048.     /**
  1049.      * @return bool
  1050.      */
  1051.     public function getLegalGuardianAuthorization()
  1052.     {
  1053.         return $this->legalGuardianAuthorization;
  1054.     }
  1055.     /**
  1056.      * @param bool $legalGuardianAuthorization
  1057.      */
  1058.     public function setLegalGuardianAuthorization($legalGuardianAuthorization)
  1059.     {
  1060.         $this->legalGuardianAuthorization = $legalGuardianAuthorization;
  1061.     }
  1062.     /**
  1063.      * @return int
  1064.      */
  1065.     public function getParentEmail()
  1066.     {
  1067.         return $this->parentEmail;
  1068.     }
  1069.     /**
  1070.      * @param int $parentEmail
  1071.      */
  1072.     public function setParentEmail($parentEmail)
  1073.     {
  1074.         $this->parentEmail = $parentEmail;
  1075.     }
  1076.     /**
  1077.      * @return string
  1078.      */
  1079.     public function getPicture()
  1080.     {
  1081.         return $this->picture;
  1082.     }
  1083.     /**
  1084.      * @param string $picture
  1085.      */
  1086.     public function setPicture($picture)
  1087.     {
  1088.         $this->picture = $picture;
  1089.     }
  1090.     /**
  1091.      * @return string
  1092.      */
  1093.     public function getPath()
  1094.     {
  1095.         return $this->path;
  1096.     }
  1097.     /**
  1098.      * @param string $path
  1099.      */
  1100.     public function setPath($path)
  1101.     {
  1102.         $this->path = $path;
  1103.     }
  1104.     public function getAbsolutePath()
  1105.     {
  1106.         return null === $this->path ? null : sprintf("%s/%s", $this->getUploadRootDir(), $this->path);
  1107.     }
  1108.     public function getWebPath()
  1109.     {
  1110.         return null === $this->path ? null : sprintf("/%s/%s", $this->getUploadDir(), $this->path);
  1111.     }
  1112.     protected function getUploadRootDir()
  1113.     {
  1114.         // le chemin absolu du répertoire où les documents uploadés doivent être sauvegardés
  1115.         return __DIR__ . '/../../../../web/' . $this->getUploadDir();
  1116.     }
  1117.     protected function getUploadDir()
  1118.     {
  1119.         // on se débarrasse de « __DIR__ » afin de ne pas avoir de problème lorsqu'on affiche
  1120.         // le document/image dans la vue.
  1121.         return sprintf('ressources/avatars/%d/', $this->id);
  1122.     }
  1123.     /**
  1124.      * @ORM\PrePersist
  1125.      * @ORM\PreUpdate
  1126.      */
  1127.     public function PreUpdate()
  1128.     {
  1129.         if (null !== $this->picture) {
  1130.             $this->removeUpload();
  1131.             $this->path = sha1(uniqid(mt_rand(), true)) . '.' . $this->picture->guessExtension();
  1132.         }
  1133.     }
  1134.     /**
  1135.      * @ORM\PostPersist
  1136.      * @ORM\PostUpdate
  1137.      */
  1138.     public function PostUpdate()
  1139.     {
  1140.         if (null === $this->picture) {
  1141.             return;
  1142.         }
  1143.         // s'il y a une erreur lors du déplacement du fichier, une exception
  1144.         // va automatiquement être lancée par la méthode move(). Cela va empêcher
  1145.         // proprement l'entité d'être persistée dans la base de données si
  1146.         // erreur il y a
  1147.         if (!is_dir($this->getUploadRootDir())) {
  1148.             mkdir($this->getUploadRootDir(), '0755', true);
  1149.         }
  1150.         $this->picture->move($this->getUploadRootDir(), $this->path);
  1151.         unset($this->picture);
  1152.     }
  1153.     /**
  1154.      * @ORM\PostRemove()
  1155.      */
  1156.     public function removeUpload()
  1157.     {
  1158.         $file = $this->getAbsolutePath();
  1159.         if (is_file($file)) {
  1160.             unlink($file);
  1161.         }
  1162.     }
  1163.     public function getAvatar()
  1164.     {
  1165.         return $this->avatar;
  1166.     }
  1167.     public function setAvatar(?string $avatar)
  1168.     {
  1169.         $this->avatar = $avatar;
  1170.     }
  1171.     /**
  1172.      * @return boolean
  1173.      */
  1174.     public function isCreditCard()
  1175.     {
  1176.         return $this->creditCard;
  1177.     }
  1178.     /**
  1179.      * @param boolean $creditCard
  1180.      */
  1181.     public function setCreditCard($creditCard)
  1182.     {
  1183.         $this->creditCard = $creditCard;
  1184.     }
  1185.     /**
  1186.      * @return mixed
  1187.      */
  1188.     public function getIsNewsletter()
  1189.     {
  1190.         return $this->isNewsletter;
  1191.     }
  1192.     /**
  1193.      * @param mixed $isNewsletter
  1194.      */
  1195.     public function setIsNewsletter($isNewsletter)
  1196.     {
  1197.         $this->isNewsletter = $isNewsletter;
  1198.     }
  1199.     /**
  1200.      * @return mixed
  1201.      */
  1202.     public function getIsCgu()
  1203.     {
  1204.         return $this->isCgu;
  1205.     }
  1206.     /**
  1207.      * @param mixed $isCgu
  1208.      */
  1209.     public function setIsCgu($isCgu)
  1210.     {
  1211.         $this->isCgu = $isCgu;
  1212.     }
  1213.     public function hasRoleSubscription()
  1214.     {
  1215.         $Subscription = array('ROLE_REVISION', 'ROLE_ASSISTANCE','ROLE_NEW_OFFER', 'ROLE_ENCADREMENT');
  1216.         foreach ($Subscription as $sub) {
  1217.             if (in_array($sub, $this->getRoles())) {
  1218.                 return $sub;
  1219.             }
  1220.         }
  1221.         return null;
  1222.     }
  1223.     /**
  1224.      * @param $role
  1225.      * @param User|null $user
  1226.      * @return bool
  1227.      */
  1228.     public function accessFonctionnality($role, User $user = null)
  1229.     {
  1230.         $hierachiqueRole = array(
  1231.             'ROLE_REVISION'    => array('ROLE_REVISION'),
  1232.             'ROLE_NEW_OFFER'   => ['ROLE_REVISION','ROLE_NEW_OFFER'],
  1233.             'ROLE_ASSISTANCE'  => array('ROLE_REVISION', 'ROLE_ASSISTANCE'),
  1234.             'ROLE_ENCADREMENT' => array('ROLE_REVISION', 'ROLE_ASSISTANCE', 'ROLE_ENCADREMENT'));
  1235.         if ($this instanceof Parents) {
  1236.             if (!$this->getChildrens()->isEmpty() && $user instanceof Student) {
  1237.                 foreach ($this->getChildrens() as $cd) {
  1238.                     if ($cd->getStudent()->getId() === $user->getId()) {
  1239.                         $verif = $user->hasRoleSubscription();
  1240.                         if (!is_null($verif)) {
  1241.                             if (in_array($role, $hierachiqueRole[$verif])) {
  1242.                                 return true;
  1243.                             }
  1244.                         }
  1245.                     }
  1246.                 }
  1247.             }
  1248.             return false;
  1249.         }
  1250.         if ($this instanceof Student) {
  1251.             $verif = $this->hasRoleSubscription($role);
  1252.             if (!is_null($verif)) {
  1253.                 if (in_array($role, $hierachiqueRole[$verif])) {
  1254.                     return true;
  1255.                 }
  1256.             }
  1257.         }
  1258.         return false;
  1259.     }
  1260.     function getIsFirstConnection()
  1261.     {
  1262.         return $this->isFirstConnection;
  1263.     }
  1264.     function setIsFirstConnection($isFirstConnection)
  1265.     {
  1266.         $this->isFirstConnection = $isFirstConnection;
  1267.     }
  1268.     /**
  1269.      * @return mixed
  1270.      */
  1271.     public function getAssessments()
  1272.     {
  1273.         return $this->assessments;
  1274.     }
  1275.     /**
  1276.      * @param mixed $assessments
  1277.      */
  1278.     public function setAssessments($assessments)
  1279.     {
  1280.         $this->assessments = $assessments;
  1281.     }
  1282.     /**
  1283.      * @param mixed $assessments
  1284.      */
  1285.     public function addAssessments($assessments)
  1286.     {
  1287.         $this->assessments[] = $assessments;
  1288.     }
  1289.     /**
  1290.      * @return mixed
  1291.      */
  1292.     public function getStripeId()
  1293.     {
  1294.         return $this->stripeId;
  1295.     }
  1296.     /**
  1297.      * @param mixed $stripeId
  1298.      */
  1299.     public function setStripeId($stripeId)
  1300.     {
  1301.         $this->stripeId = $stripeId;
  1302.     }
  1303.     public function getCivility()
  1304.     {
  1305.         return $this->civility;
  1306.     }
  1307.     /**
  1308.      * @param mixed $civility
  1309.      */
  1310.     public function setCivility($civility)
  1311.     {
  1312.         $this->civility = $civility;
  1313.     }
  1314.     /**
  1315.      * @return mixed
  1316.      */
  1317.     public function getGender()
  1318.     {
  1319.         return $this->gender;
  1320.     }
  1321.     /**
  1322.      * @param mixed $gender
  1323.      */
  1324.     public function setGender($gender)
  1325.     {
  1326.         $this->gender = $gender;
  1327.     }
  1328.     /**
  1329.      * @return string
  1330.      */
  1331.     public function getRegistrationProfile()
  1332.     {
  1333.         return $this->registrationProfile;
  1334.     }
  1335.     /**
  1336.      * @param string $registrationProfile
  1337.      */
  1338.     public function setRegistrationProfile($registrationProfile)
  1339.     {
  1340.         $this->registrationProfile = $registrationProfile;
  1341.     }
  1342.     /**
  1343.      * @return string
  1344.      */
  1345.     public function getProfilePicture()
  1346.     {
  1347.         return $this->profilePicture;
  1348.     }
  1349.     /**
  1350.      * @param string $profilePicture
  1351.      */
  1352.     public function setProfilePicture($profilePicture)
  1353.     {
  1354.         $this->profilePicture = $profilePicture;
  1355.     }
  1356.     public function getCourse()
  1357.     {
  1358.         return null;
  1359.     }
  1360.     public function getSerie()
  1361.     {
  1362.         return null;
  1363.     }
  1364.     /**
  1365.      * Get creditCard
  1366.      *
  1367.      * @return boolean
  1368.      */
  1369.     public function getCreditCard()
  1370.     {
  1371.         return $this->creditCard;
  1372.     }
  1373.     /**
  1374.      * Set newDashboardWelcomeMessage
  1375.      *
  1376.      * @param boolean $newDashboardWelcomeMessage
  1377.      * @return User
  1378.      */
  1379.     public function setNewDashboardWelcomeMessage($newDashboardWelcomeMessage)
  1380.     {
  1381.         $this->newDashboardWelcomeMessage = $newDashboardWelcomeMessage;
  1382.         return $this;
  1383.     }
  1384.     /**
  1385.      * Get newDashboardWelcomeMessage
  1386.      *
  1387.      * @return boolean
  1388.      */
  1389.     public function getNewDashboardWelcomeMessage()
  1390.     {
  1391.         return $this->newDashboardWelcomeMessage;
  1392.     }
  1393.     /**
  1394.      * @return int
  1395.      */
  1396.     public function getEmailValidation()
  1397.     {
  1398.         return $this->emailValidation;
  1399.     }
  1400.     /**
  1401.      * @param int $emailValidation
  1402.      */
  1403.     public function setEmailValidation($emailValidation)
  1404.     {
  1405.         $this->emailValidation = $emailValidation;
  1406.     }
  1407.     /**
  1408.      * @return string
  1409.      */
  1410.     public function getEmailValidationToken()
  1411.     {
  1412.         return $this->emailValidationToken;
  1413.     }
  1414.     /**
  1415.      * @param string $emailValidationToken
  1416.      */
  1417.     public function setEmailValidationToken($emailValidationToken)
  1418.     {
  1419.         $this->emailValidationToken = $emailValidationToken;
  1420.     }
  1421.     /**
  1422.      * @return string
  1423.      */
  1424.     public function getEmailValidationTokenRequestedAt()
  1425.     {
  1426.         return $this->emailValidationTokenRequestedAt;
  1427.     }
  1428.     /**
  1429.      * @param \DateTime $emailValidationTokenRequestedAt
  1430.      */
  1431.     public function setEmailValidationTokenRequestedAt($emailValidationTokenRequestedAt)
  1432.     {
  1433.         $this->emailValidationTokenRequestedAt = $emailValidationTokenRequestedAt;
  1434.     }
  1435.     /**
  1436.      * Add offers
  1437.      *
  1438.      * @param OfferStudent $offers
  1439.      * @return User
  1440.      */
  1441.     public function addOffer($offers)
  1442.     {
  1443.         $this->offers[] = $offers;
  1444.         return $this;
  1445.     }
  1446.     /**
  1447.      * Remove offers
  1448.      *
  1449.      * @param \Bo\StudentBundle\Entity\OfferStudent $offers
  1450.      */
  1451.     public function removeOffer( $offers)
  1452.     {
  1453.         $this->offers->removeElement($offers);
  1454.     }
  1455.     /**
  1456.      * @return null|Student
  1457.      */
  1458.     public function getStudentEntity()
  1459.     {
  1460.         if ($this->offers->isEmpty() == false) {
  1461.             $lastOfferStudent = $this->offers->last();
  1462.             if ($lastOfferStudent) {
  1463.                 return $lastOfferStudent->getStudent();
  1464.             }
  1465.         }
  1466.         return null;
  1467.     }
  1468.     /**
  1469.      * @return null|Parents
  1470.      */
  1471.     public function getParentEntity()
  1472.     {
  1473.         if ($this->offers->isEmpty() == false) {
  1474.             $lastOfferStudent = $this->offers->last();
  1475.             if ($lastOfferStudent) {
  1476.                 return $lastOfferStudent->getParent();
  1477.             }
  1478.         }
  1479.         return null;
  1480.     }
  1481.     /**
  1482.      * Add reports
  1483.      *
  1484.      * @param \Bo\ReportBundle\Entity\Report $reports
  1485.      * @return User
  1486.      */
  1487.     public function addReport( $reports)
  1488.     {
  1489.         $this->reports[] = $reports;
  1490.         return $this;
  1491.     }
  1492.     /**
  1493.      * Remove reports
  1494.      *
  1495.      * @param \Bo\ReportBundle\Entity\Report $reports
  1496.      */
  1497.     public function removeReport( $reports)
  1498.     {
  1499.         $this->reports->removeElement($reports);
  1500.     }
  1501.     /**
  1502.      * Add assessments
  1503.      *
  1504.      * @param \Bo\AdministratorsBundle\Entity\Assessment $assessments
  1505.      * @return User
  1506.      */
  1507.     public function addAssessment( $assessments)
  1508.     {
  1509.         $this->assessments[] = $assessments;
  1510.         return $this;
  1511.     }
  1512.     /**
  1513.      * Remove assessments
  1514.      *
  1515.      * @param \Bo\AdministratorsBundle\Entity\Assessment $assessments
  1516.      */
  1517.     public function removeAssessment( $assessments)
  1518.     {
  1519.         $this->assessments->removeElement($assessments);
  1520.     }
  1521.     /**
  1522.      * @return mixed
  1523.      */
  1524.     public function getPopinShareGoodDeal()
  1525.     {
  1526.         return $this->popinShareGoodDeal;
  1527.     }
  1528.     /**
  1529.      * @param mixed $popinShareGoodDeal
  1530.      */
  1531.     public function setPopinShareGoodDeal($popinShareGoodDeal)
  1532.     {
  1533.         $this->popinShareGoodDeal = $popinShareGoodDeal;
  1534.     }
  1535.     /**
  1536.      * @return string
  1537.      */
  1538.     public function getDiscr()
  1539.     {
  1540.         return "other";
  1541.     }
  1542.     public function customCivility()
  1543.     {
  1544.         if ($this->civility == User::CIVILITY_MR) {
  1545.             return "Monsieur";
  1546.         }
  1547.         return "Madame";
  1548.     }
  1549.     /**
  1550.      * @return \DateTime
  1551.      */
  1552.     public function getDateSychronisationIntercom()
  1553.     {
  1554.         return $this->dateSychronisationIntercom;
  1555.     }
  1556.     /**
  1557.      * @param \DateTime $dateSychronisationIntercom
  1558.      */
  1559.     public function setDateSychronisationIntercom(\DateTime $dateSychronisationIntercom): void
  1560.     {
  1561.         $this->dateSychronisationIntercom = $dateSychronisationIntercom;
  1562.     }
  1563.     /**
  1564.      *
  1565.      * Set civility by gender
  1566.      * //NOTE : It's for student with gender but without civility
  1567.      *
  1568.      */
  1569.     public function setCivilityByGender()
  1570.     {
  1571.       if($this->civility === null and $this->gender !== null) {
  1572.         switch ($this->gender) {
  1573.             case self::GENDER_FEMALE :
  1574.                 $this->civility = self::CIVILITY_MISS;
  1575.                 break;
  1576.             case self::GENDER_MALE :
  1577.                 $this->civility = self::CIVILITY_MR;
  1578.                 break;
  1579.         }
  1580.       }
  1581.     }
  1582.     public function getPassword() : string
  1583.     {
  1584.         return $this->password;
  1585.     }
  1586.     /**
  1587.      * @param mixed $password
  1588.      */
  1589.     public function setPassword($password): void
  1590.     {
  1591.         $this->password = $password;
  1592.     }
  1593.     public function getSalt()
  1594.     {
  1595.         return $this->salt;
  1596.     }
  1597.     public function eraseCredentials()
  1598.     {
  1599.         // TODO: Implement eraseCredentials() method.
  1600.     }
  1601.     public function getUsername()
  1602.     {
  1603.         return $this->username;
  1604.     }
  1605.     public function setUsername($username)
  1606.     {
  1607.         $this->username = $username;
  1608.     }
  1609.     public function __call($name, $arguments)
  1610.     {
  1611.         // TODO: Implement @method string getUserIdentifier()
  1612.     }
  1613.     /**
  1614.      * @return mixed
  1615.      */
  1616.     public function getFileAvatar()
  1617.     {
  1618.         return $this->fileAvatar;
  1619.     }
  1620.     /**
  1621.      * @param mixed $fileAvatar
  1622.      */
  1623.     public function setFileAvatar($fileAvatar): void
  1624.     {
  1625.         $this->fileAvatar = $fileAvatar;
  1626.     }
  1627.     public function serialize($data, string $format, array $context = [])
  1628.     {
  1629.         // TODO: Implement serialize() method.
  1630.         return serialize(array(
  1631.             $this->id,
  1632.             $this->password,
  1633.         ));
  1634.     }
  1635.     public function deserialize($data, string $type, string $format, array $context = [])
  1636.     {
  1637.         // TODO: Implement deserialize() method.
  1638.         list (
  1639.             $this->id,
  1640.             $this->password,
  1641.             ) = unserialize($data, array('allowed_classes' => false));
  1642.     }
  1643.     public function getUserIdentifier(){
  1644.         return $this->id;
  1645.     }
  1646.     public function isEqualTo(UserInterface $user)
  1647.     {
  1648.         // TODO: Implement isEqualTo() method.
  1649.         return $user->getUserIdentifier() == $this->id;
  1650.     }
  1651.     /**
  1652.      * @return mixed
  1653.      */
  1654.     public function getEnabled()
  1655.     {
  1656.         return $this->enabled;
  1657.     }
  1658.     /**
  1659.      * @param mixed $enabled
  1660.      */
  1661.     public function setEnabled($enabled): void
  1662.     {
  1663.         $this->enabled = $enabled;
  1664.     }
  1665.     public function setPlainPassword($password)
  1666.     {
  1667.         $this->plainPassword = $password;
  1668.         return $this;
  1669.     }
  1670.     public function getPlainPassword()
  1671.     {
  1672.         return $this->plainPassword;
  1673.     }
  1674.     /**
  1675.      * @return bool
  1676.      */
  1677.     public function isVerified(): ?bool
  1678.     {
  1679.         return $this->isVerified;
  1680.     }
  1681.     /**
  1682.      * @param bool $isVerified
  1683.      */
  1684.     public function setIsVerified(bool $isVerified): void
  1685.     {
  1686.         $this->isVerified = $isVerified;
  1687.     }
  1688. }