src/AppBundle/Entity/Website.php line 29

Open in your IDE?
  1. <?php
  2. namespace AppBundle\Entity;
  3. use Doctrine\Common\Collections\Collection;
  4. use AppBundle\Entity\Traits\TimestampableTrait;
  5. use AppBundle\Entity\Traits\IsActiveTrait;
  6. use AppBundle\Entity\Traits\PictureTrait;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. use Symfony\Component\HttpFoundation\File\File;
  12. use Symfony\Component\Security\Core\User\UserInterface;
  13. use Doctrine\Common\Collections\ArrayCollection;
  14. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  15. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  16. /**
  17.  * Website
  18.  *
  19.  * @ORM\Table(name="Website")
  20.  * @ORM\Entity(repositoryClass="AppBundle\Entity\Repository\WebsiteRepository")
  21.  * @Vich\Uploadable
  22.  * @ORM\HasLifecycleCallbacks
  23.  * @UniqueEntity("email", groups={"creation", "configuration"}, message="Adresse e-mail déjà utilisée")
  24.  * @UniqueEntity("url", groups={"creation"}, message="Ce nom de domaine est déjà utilisé")
  25.  */
  26. class Website implements UserInterface\SerializablePasswordAuthenticatedUserInterface
  27. {
  28.     use TimestampableTrait;
  29.     use IsActiveTrait;
  30.     /**
  31.      * @var integer
  32.      *
  33.      * @ORM\Column(name="id", type="integer")
  34.      * @ORM\Id
  35.      * @ORM\GeneratedValue(strategy="AUTO")
  36.      */
  37.     private $id;
  38.     /**
  39.      * @var string
  40.      *
  41.      * @ORM\Column(name="club_name", type="string", length=255, nullable=true)
  42.      * @Assert\NotBlank(groups={"admin", "creation", "configuration"})
  43.      * @Assert\Length(max="35", maxMessage="Le nom du club doit faire au maximum {{ limit }} caractères", groups={"admin", "creation", "configuration"})
  44.      */
  45.     private $clubName;
  46.     /**
  47.      * @var string
  48.      *
  49.      * @ORM\Column(name="url", type="string", length=255, nullable=true)
  50.      */
  51.     private $url;
  52.     /**
  53.      * @var string
  54.      *
  55.      * @ORM\Column(name="club_number", type="string", length=255, nullable=true)
  56.      * @Assert\NotBlank(groups={"admin", "creation", "configuration"})
  57.      */
  58.     private $clubNumber;
  59.     /**
  60.      * @var string
  61.      *
  62.      * @ORM\Column(name="address", type="string", length=255, nullable=true)
  63.      */
  64.     private $address;
  65.     /**
  66.      * @var string
  67.      *
  68.      * @ORM\Column(name="zipcode", type="string", length=255, nullable=true)
  69.      */
  70.     private $zipcode;
  71.     /**
  72.      * @var string
  73.      *
  74.      * @ORM\Column(name="city", type="string", length=255, nullable=true)
  75.      */
  76.     private $city;
  77.     /**
  78.      * @var string
  79.      *
  80.      * @ORM\Column(name="latitude", type="float", nullable=true)
  81.      */
  82.     private $latitude;
  83.     /**
  84.      * @var string
  85.      *
  86.      * @ORM\Column(name="longitude", type="float", nullable=true)
  87.      */
  88.     private $longitude;
  89.     /**
  90.      * @var string
  91.      *
  92.      * @ORM\Column(name="phone", type="string", length=255, nullable=true)
  93.      */
  94.     private $phone;
  95.     /**
  96.      * @var string
  97.      *
  98.      * @ORM\Column(name="contact_email", type="string", length=255, nullable=true)
  99.      * @Assert\NotBlank(groups={"admin", "configuration"})
  100.      */
  101.     private $contactEmail;
  102.     /**
  103.      * @var string
  104.      *
  105.      * @ORM\Column(name="contact_name", type="string", length=255, nullable=true)
  106.      * @Assert\NotBlank(groups={"admin", "configuration"})
  107.      */
  108.     private $contactName;
  109.     /**
  110.      * @var string
  111.      *
  112.      * @ORM\Column(name="responsable_lastname", type="string", length=255, nullable=true)
  113.      */
  114.     private $responsableLastname;
  115.     /**
  116.      * @var string
  117.      *
  118.      * @ORM\Column(name="responsable_firstname", type="string", length=255, nullable=true)
  119.      */
  120.     private $responsableFirstname;
  121.     /**
  122.      * @var string
  123.      *
  124.      * @ORM\Column(name="responsable_email", type="string", length=255, nullable=true)
  125.      * @Assert\NotBlank(groups={"admin", "configuration"})
  126.      */
  127.     private $responsableEmail;
  128.     /**
  129.      * @var string
  130.      *
  131.      * @ORM\Column(name="club_responsable", type="string", length=255, nullable=true)
  132.      * @Assert\NotBlank(groups={"admin", "configuration"})
  133.      */
  134.     private $clubResponsable;
  135.     /**
  136.      * @ORM\Column(name="is_online_subscribed", type="boolean", nullable=true)
  137.      */
  138.     private bool $isOnlineSubscribed false;
  139.     /**
  140.      * @ORM\Column(name="is_complete", type="boolean", nullable=true)
  141.      */
  142.     private bool $isComplete false;
  143.     /**
  144.      * @ORM\Column(name="theme_color", type="string", length=255, nullable=true)
  145.      */
  146.     private string $themeColor 'blue';
  147.     /**
  148.      * @ORM\Column(name="theme_site", type="string", length=255, nullable=true)
  149.      */
  150.     private string $themeSite '1';
  151.     /**
  152.      * @var string
  153.      *
  154.      * @Gedmo\Slug(fields={"clubName"}, updatable=false)
  155.      * @ORM\Column(type="string", length=255)
  156.      */
  157.     private $slug;
  158.     /**
  159.      * @var string
  160.      *
  161.      * @ORM\Column(name="password", type="string", length=255)
  162.      * @Assert\NotBlank(groups={"creation"})
  163.      * @Assert\Length(min="6", minMessage="Le mot de passe doit faire au moins {{ limit }} caractères", groups={"creation"})
  164.      */
  165.     private $password;
  166.     /**
  167.      * @var string
  168.      *
  169.      * @ORM\Column(name="email", type="string", length=255)
  170.      * @Assert\NotBlank(groups={"creation", "configuration"})
  171.      * @Assert\Email(groups={"creation", "configuration"})
  172.      */
  173.     private $email;
  174.     /**
  175.      * @var string
  176.      *
  177.      * @ORM\Column(name="facebook_url", type="string", length=255, nullable=true)
  178.      */
  179.     private $facebookUrl;
  180.     /**
  181.      * @var string
  182.      *
  183.      * @ORM\Column(name="twitter_url", type="string", length=255, nullable=true)
  184.      */
  185.     private $twitterUrl;
  186.     /**
  187.      * @var string
  188.      *
  189.      * @ORM\Column(name="instagram_url", type="string", length=255, nullable=true)
  190.      */
  191.     private $instagramUrl;
  192.     /**
  193.      * @var string
  194.      *
  195.      * @ORM\Column(name="youtube_url", type="string", length=255, nullable=true)
  196.      */
  197.     private $youtubeUrl;
  198.     /**
  199.      * @ORM\Column(name="salt", type="string", length=255)
  200.      */
  201.     private string $salt;
  202.     /**
  203.      * @var integer
  204.      *
  205.      * @ORM\Column(name="news_position", type="integer", nullable=true, options= {"default" : 1})
  206.      */
  207.     private $newsPosition 1;
  208.     /**
  209.      * @var bool
  210.      *
  211.      * @ORM\Column(name="news_visible", type="boolean", options= {"default" : 1})
  212.      */
  213.     private $newsVisible true;
  214.     /**
  215.      * @var integer
  216.      *
  217.      * @ORM\Column(name="event_position", type="integer", nullable=true, options= {"default" : 2})
  218.      */
  219.     private $eventPosition 2;
  220.     /**
  221.      * @var bool
  222.      *
  223.      * @ORM\Column(name="event_visible", type="boolean", options= {"default" : 1})
  224.      */
  225.     private $eventVisible true;
  226.     /**
  227.      * @var integer
  228.      *
  229.      * @ORM\Column(name="gallery_position", type="integer", nullable=true, options= {"default" : 3})
  230.      */
  231.     private $galleryPosition 3;
  232.     /**
  233.      * @var bool
  234.      *
  235.      * @ORM\Column(name="gallery_visible", type="boolean", options= {"default" : 1})
  236.      */
  237.     private $galleryVisible true;
  238.     /**
  239.      * @var datetime $cgu_at
  240.      *
  241.      * @ORM\Column(name="cgu_at", type="datetime")
  242.      */
  243.     private \Datetime $cguAt;
  244.     /**
  245.      * @var string $authenticationToken
  246.      *
  247.      * @ORM\Column(name="authentication_token", type="string", length=255, nullable=true)
  248.      */
  249.     private $authenticationToken;
  250.     /**
  251.      * @ORM\OneToMany(targetEntity="Partner", mappedBy="website", cascade={"persist", "remove"})
  252.      */
  253.     protected $partners;
  254.     /**
  255.      * @ORM\OneToMany(targetEntity="News", mappedBy="website", cascade={"persist", "remove"})
  256.      */
  257.     protected $news;
  258.     /**
  259.      * @ORM\OneToMany(targetEntity="Event", mappedBy="website", cascade={"persist", "remove"})
  260.      */
  261.     protected $events;
  262.     /**
  263.      * @ORM\OneToMany(targetEntity="Gallery", mappedBy="website", cascade={"persist", "remove"})
  264.      * @ORM\OrderBy({"displayDate" = "DESC"})
  265.      */
  266.     protected $galleries;
  267.     /**
  268.      * @ORM\OneToMany(targetEntity="Page", mappedBy="website", cascade={"persist", "remove"})
  269.      */
  270.     protected $pages;
  271.     /**
  272.      * @ORM\ManyToOne(targetEntity="Contract", inversedBy="websites")
  273.      * @ORM\JoinColumn(name="contract_id", referencedColumnName="id", nullable=true, onDelete="cascade")
  274.      */
  275.     protected $contract;
  276.     /**
  277.      * @Assert\Image(
  278.      *     maxSize="8M",
  279.      *     minWidth="500",
  280.      *     minHeight="333",
  281.      *     groups={"creation", "configuration"},
  282.      *     mimeTypes={"image/png", "image/jpeg"}
  283.      * )
  284.      * @Vich\UploadableField(mapping="default_picture", fileNameProperty="pictureName")
  285.      *
  286.      * @var File $picture
  287.      */
  288.     protected $picture;
  289.     /**
  290.      * @ORM\Column(name="picture_name", type="string", length=255, nullable=true)
  291.      *
  292.      * @var string $pictureName
  293.      */
  294.     protected $pictureName;
  295.     public function __construct()
  296.     {
  297.         $this->salt base_convert(sha1(uniqid(random_int(0mt_getrandmax()), true)), 1636);
  298.         $this->partners = new ArrayCollection();
  299.         $this->news = new ArrayCollection();
  300.         $this->events = new ArrayCollection();
  301.         $this->galleries = new ArrayCollection();
  302.         $this->pages = new ArrayCollection();
  303.         $this->cguAt = new \Datetime();
  304.     }
  305.     public function __toString()
  306.     {
  307.         if($this->clubName) return $this->clubName;
  308.         return "new";
  309.     }
  310.     public function serialize()
  311.     {
  312.         return serialize([$this->id$this->email$this->password$this->salt]);
  313.     }
  314.     /** @see \Serializable::unserialize() */
  315.     public function unserialize($serialized)
  316.     {
  317.         [$this->id$this->email$this->password$this->salt] = unserialize($serialized);
  318.     }
  319.     /**
  320.      * Get id
  321.      *
  322.      * @return integer
  323.      */
  324.     public function getId()
  325.     {
  326.         return $this->id;
  327.     }
  328.     /**
  329.      * Set name
  330.      *
  331.      * @param  string  $name
  332.      * @return Product
  333.      */
  334.     public function setName($name)
  335.     {
  336.         $this->name $name;
  337.         return $this;
  338.     }
  339.     /**
  340.      * Get name
  341.      *
  342.      * @return string
  343.      */
  344.     public function getName()
  345.     {
  346.         return $this->name;
  347.     }
  348.     /**
  349.      * Get username
  350.      *
  351.      * @return string
  352.      */
  353.     public function getUsername()
  354.     {
  355.         return $this->email;
  356.     }
  357.     /**
  358.      * Set password
  359.      *
  360.      * @param string $password
  361.      *
  362.      * @return User
  363.      */
  364.     public function setPassword($password)
  365.     {
  366.         $this->password $password;
  367.         return $this;
  368.     }
  369.     /**
  370.      * Get password
  371.      *
  372.      * @return string
  373.      */
  374.     public function getPassword(): ?string
  375.     {
  376.         return $this->password;
  377.     }
  378.     /**
  379.      * Set email
  380.      *
  381.      * @param string $email
  382.      *
  383.      * @return User
  384.      */
  385.     public function setEmail($email)
  386.     {
  387.         $this->email $email;
  388.         return $this;
  389.     }
  390.     /**
  391.      * Get email
  392.      *
  393.      * @return string
  394.      */
  395.     public function getEmail()
  396.     {
  397.         return $this->email;
  398.     }
  399.     public function getSalt()
  400.     {
  401.         return $this->salt;
  402.     }
  403.     public function getSlug()
  404.     {
  405.         return $this->slug;
  406.     }
  407.     public function getRoles()
  408.     {
  409.         return ['ROLE_WEBMASTER'];
  410.     }
  411.     public function eraseCredentials()
  412.     {
  413.     }
  414.     /**
  415.      * Set clubName
  416.      *
  417.      * @param string $clubName
  418.      *
  419.      * @return Website
  420.      */
  421.     public function setClubName($clubName)
  422.     {
  423.         $this->clubName $clubName;
  424.         return $this;
  425.     }
  426.     /**
  427.      * Get clubName
  428.      *
  429.      * @return string
  430.      */
  431.     public function getClubName()
  432.     {
  433.         return $this->clubName;
  434.     }
  435.     /**
  436.      * Set clubNumber
  437.      *
  438.      * @param string $clubNumber
  439.      *
  440.      * @return Website
  441.      */
  442.     public function setClubNumber($clubNumber)
  443.     {
  444.         $this->clubNumber $clubNumber;
  445.         return $this;
  446.     }
  447.     /**
  448.      * Get clubNumber
  449.      *
  450.      * @return string
  451.      */
  452.     public function getClubNumber()
  453.     {
  454.         return $this->clubNumber;
  455.     }
  456.     /**
  457.      * Set address
  458.      *
  459.      * @param string $address
  460.      *
  461.      * @return Website
  462.      */
  463.     public function setAddress($address)
  464.     {
  465.         $this->address $address;
  466.         return $this;
  467.     }
  468.     /**
  469.      * Get address
  470.      *
  471.      * @return string
  472.      */
  473.     public function getAddress()
  474.     {
  475.         return $this->address;
  476.     }
  477.     /**
  478.      * Set zipcode
  479.      *
  480.      * @param string $zipcode
  481.      *
  482.      * @return Website
  483.      */
  484.     public function setZipcode($zipcode)
  485.     {
  486.         $this->zipcode $zipcode;
  487.         return $this;
  488.     }
  489.     /**
  490.      * Get zipcode
  491.      *
  492.      * @return string
  493.      */
  494.     public function getZipcode()
  495.     {
  496.         return $this->zipcode;
  497.     }
  498.     /**
  499.      * Set city
  500.      *
  501.      * @param string $city
  502.      *
  503.      * @return Website
  504.      */
  505.     public function setCity($city)
  506.     {
  507.         $this->city $city;
  508.         return $this;
  509.     }
  510.     /**
  511.      * Get city
  512.      *
  513.      * @return string
  514.      */
  515.     public function getCity()
  516.     {
  517.         return $this->city;
  518.     }
  519.     /**
  520.      * Set latitude
  521.      *
  522.      * @param float $latitude
  523.      *
  524.      * @return Website
  525.      */
  526.     public function setLatitude($latitude)
  527.     {
  528.         $this->latitude $latitude;
  529.         return $this;
  530.     }
  531.     /**
  532.      * Get latitude
  533.      *
  534.      * @return float
  535.      */
  536.     public function getLatitude()
  537.     {
  538.         return $this->latitude;
  539.     }
  540.     /**
  541.      * Set longitude
  542.      *
  543.      * @param float $longitude
  544.      *
  545.      * @return Website
  546.      */
  547.     public function setLongitude($longitude)
  548.     {
  549.         $this->longitude $longitude;
  550.         return $this;
  551.     }
  552.     /**
  553.      * Get longitude
  554.      *
  555.      * @return float
  556.      */
  557.     public function getLongitude()
  558.     {
  559.         return $this->longitude;
  560.     }
  561.     /**
  562.      * Set phone
  563.      *
  564.      * @param string $phone
  565.      *
  566.      * @return Website
  567.      */
  568.     public function setPhone($phone)
  569.     {
  570.         $this->phone $phone;
  571.         return $this;
  572.     }
  573.     /**
  574.      * Get phone
  575.      *
  576.      * @return string
  577.      */
  578.     public function getPhone()
  579.     {
  580.         return $this->phone;
  581.     }
  582.     /**
  583.      * Set contactEmail
  584.      *
  585.      * @param string $contactEmail
  586.      *
  587.      * @return Website
  588.      */
  589.     public function setContactEmail($contactEmail)
  590.     {
  591.         $this->contactEmail $contactEmail;
  592.         return $this;
  593.     }
  594.     /**
  595.      * Get contactEmail
  596.      *
  597.      * @return string
  598.      */
  599.     public function getContactEmail()
  600.     {
  601.         return $this->contactEmail;
  602.     }
  603.     /**
  604.      * Set contactName
  605.      *
  606.      * @param string $contactName
  607.      *
  608.      * @return Website
  609.      */
  610.     public function setContactName($contactName)
  611.     {
  612.         $this->contactName $contactName;
  613.         return $this;
  614.     }
  615.     /**
  616.      * Get contactName
  617.      *
  618.      * @return string
  619.      */
  620.     public function getContactName()
  621.     {
  622.         return $this->contactName;
  623.     }
  624.     /**
  625.      * Set isOnlineSubscribed
  626.      *
  627.      * @param boolean $isOnlineSubscribed
  628.      *
  629.      * @return Website
  630.      */
  631.     public function setIsOnlineSubscribed($isOnlineSubscribed)
  632.     {
  633.         $this->isOnlineSubscribed $isOnlineSubscribed;
  634.         return $this;
  635.     }
  636.     /**
  637.      * Get isOnlineSubscribed
  638.      *
  639.      * @return boolean
  640.      */
  641.     public function getIsOnlineSubscribed()
  642.     {
  643.         return $this->isOnlineSubscribed;
  644.     }
  645.     /**
  646.      * Set themeColor
  647.      *
  648.      * @param string $themeColor
  649.      *
  650.      * @return Website
  651.      */
  652.     public function setThemeColor($themeColor)
  653.     {
  654.         $this->themeColor $themeColor;
  655.         return $this;
  656.     }
  657.     /**
  658.      * Get themeColor
  659.      *
  660.      * @return string
  661.      */
  662.     public function getThemeColor()
  663.     {
  664.         return $this->themeColor;
  665.     }
  666.     /**
  667.      * Set themeSite
  668.      *
  669.      * @param string $themeSite
  670.      *
  671.      * @return Website
  672.      */
  673.     public function setThemeSite($themeSite)
  674.     {
  675.         $this->themeSite $themeSite;
  676.         return $this;
  677.     }
  678.     /**
  679.      * Get themeSite
  680.      *
  681.      * @return string
  682.      */
  683.     public function getThemeSite()
  684.     {
  685.         return $this->themeSite;
  686.     }
  687.     /**
  688.      * Set url
  689.      *
  690.      * @param string $url
  691.      *
  692.      * @return Website
  693.      */
  694.     public function setUrl($url)
  695.     {
  696.         $this->url $url;
  697.         return $this;
  698.     }
  699.     /**
  700.      * Get url
  701.      *
  702.      * @return string
  703.      */
  704.     public function getUrl()
  705.     {
  706.         if(strstr($this->url'https') !== false) {
  707.             return $this->url;
  708.         }
  709.         else {
  710.             return 'https://'.$this->url;
  711.         }
  712.     }
  713.     /**
  714.      * Set salt
  715.      *
  716.      * @param string $salt
  717.      *
  718.      * @return Website
  719.      */
  720.     public function setSalt($salt)
  721.     {
  722.         $this->salt $salt;
  723.         return $this;
  724.     }
  725.     /**
  726.      * Add partner
  727.      *
  728.      * @param Partner $partner
  729.      *
  730.      * @return Website
  731.      */
  732.     public function addPartner(Partner $partner)
  733.     {
  734.         $partner->setWebsite($this);
  735.         $this->partners[] = $partner;
  736.         return $this;
  737.     }
  738.     /**
  739.      * Remove partner
  740.      *
  741.      * @param Partner $partner
  742.      */
  743.     public function removePartner(Partner $partner)
  744.     {
  745.         $this->partners->removeElement($partner);
  746.     }
  747.     /**
  748.      * Get partners
  749.      *
  750.      * @return Collection
  751.      */
  752.     public function getPartners()
  753.     {
  754.         return $this->partners;
  755.     }
  756.     /**
  757.      * Add news
  758.      *
  759.      * @param News $news
  760.      *
  761.      * @return Website
  762.      */
  763.     public function addNews(News $news)
  764.     {
  765.         $news->setWebsite($this);
  766.         $this->news[] = $news;
  767.         return $this;
  768.     }
  769.     /**
  770.      * Remove news
  771.      *
  772.      * @param News $news
  773.      */
  774.     public function removeNews(News $news)
  775.     {
  776.         $this->news->removeElement($news);
  777.     }
  778.     /**
  779.      * Get news
  780.      *
  781.      * @return Collection
  782.      */
  783.     public function getNews()
  784.     {
  785.         return $this->news;
  786.     }
  787.     /**
  788.      * Add event
  789.      *
  790.      * @param Event $event
  791.      *
  792.      * @return Website
  793.      */
  794.     public function addEvent(Event $event)
  795.     {
  796.         $event->setWebsite($this);
  797.         $this->events[] = $event;
  798.         return $this;
  799.     }
  800.     /**
  801.      * Remove event
  802.      *
  803.      * @param Event $event
  804.      */
  805.     public function removeEvent(Event $event)
  806.     {
  807.         $this->events->removeElement($event);
  808.     }
  809.     /**
  810.      * Get events
  811.      *
  812.      * @return Collection
  813.      */
  814.     public function getEvents()
  815.     {
  816.         return $this->events;
  817.     }
  818.     /**
  819.      * Add gallery
  820.      *
  821.      * @param Gallery $gallery
  822.      *
  823.      * @return Website
  824.      */
  825.     public function addGallery(Gallery $gallery)
  826.     {
  827.         $gallery->setWebsite($this);
  828.         $this->galleries[] = $gallery;
  829.         return $this;
  830.     }
  831.     /**
  832.      * Remove gallery
  833.      *
  834.      * @param Gallery $gallery
  835.      */
  836.     public function removeGallery(Gallery $gallery)
  837.     {
  838.         $this->galleries->removeElement($gallery);
  839.     }
  840.     /**
  841.      * Get galleries
  842.      *
  843.      * @return Collection
  844.      */
  845.     public function getGalleries()
  846.     {
  847.         return $this->galleries;
  848.     }
  849.     /**
  850.      * Add page
  851.      *
  852.      * @param Page $page
  853.      *
  854.      * @return Website
  855.      */
  856.     public function addPage(Page $page)
  857.     {
  858.         $page->setWebsite($this);
  859.         $this->pages[] = $page;
  860.         return $this;
  861.     }
  862.     /**
  863.      * Remove page
  864.      *
  865.      * @param Page $page
  866.      */
  867.     public function removePage(Page $page)
  868.     {
  869.         $this->pages->removeElement($page);
  870.     }
  871.     /**
  872.      * Get pages
  873.      *
  874.      * @return Collection
  875.      */
  876.     public function getPages()
  877.     {
  878.         return $this->pages;
  879.     }
  880.     /**
  881.      * Set facebookUrl
  882.      *
  883.      * @param string $facebookUrl
  884.      *
  885.      * @return Website
  886.      */
  887.     public function setFacebookUrl($facebookUrl)
  888.     {
  889.         $this->facebookUrl $facebookUrl;
  890.         return $this;
  891.     }
  892.     /**
  893.      * Get facebookUrl
  894.      *
  895.      * @return string
  896.      */
  897.     public function getFacebookUrl()
  898.     {
  899.         return $this->facebookUrl;
  900.     }
  901.     /**
  902.      * Set twitterUrl
  903.      *
  904.      * @param string $twitterUrl
  905.      *
  906.      * @return Website
  907.      */
  908.     public function setTwitterUrl($twitterUrl)
  909.     {
  910.         $this->twitterUrl $twitterUrl;
  911.         return $this;
  912.     }
  913.     /**
  914.      * Get twitterUrl
  915.      *
  916.      * @return string
  917.      */
  918.     public function getTwitterUrl()
  919.     {
  920.         return $this->twitterUrl;
  921.     }
  922.     /**
  923.      * Set instagramUrl
  924.      *
  925.      * @param string $instagramUrl
  926.      *
  927.      * @return Website
  928.      */
  929.     public function setInstagramUrl($instagramUrl)
  930.     {
  931.         $this->instagramUrl $instagramUrl;
  932.         return $this;
  933.     }
  934.     /**
  935.      * Get instagramUrl
  936.      *
  937.      * @return string
  938.      */
  939.     public function getInstagramUrl()
  940.     {
  941.         return $this->instagramUrl;
  942.     }
  943.     /**
  944.      * Set youtubeUrl
  945.      *
  946.      * @param string $youtubeUrl
  947.      *
  948.      * @return Website
  949.      */
  950.     public function setYoutubeUrl($youtubeUrl)
  951.     {
  952.         $this->youtubeUrl $youtubeUrl;
  953.         return $this;
  954.     }
  955.     /**
  956.      * Get youtubeUrl
  957.      *
  958.      * @return string
  959.      */
  960.     public function getYoutubeUrl()
  961.     {
  962.         return $this->youtubeUrl;
  963.     }
  964.     /**
  965.      * Set usageContract
  966.      *
  967.      * @param UsageContract $usageContract
  968.      *
  969.      * @return Website
  970.      */
  971.     public function setContract(Contract $contract null)
  972.     {
  973.         $this->contract $contract;
  974.         return $this;
  975.     }
  976.     /**
  977.      * Get usageContract
  978.      *
  979.      * @return UsageContract
  980.      */
  981.     public function getContract()
  982.     {
  983.         return $this->contract;
  984.     }
  985.     /**
  986.      * Set isComplete
  987.      *
  988.      * @param boolean $isComplete
  989.      *
  990.      * @return Website
  991.      */
  992.     public function setIsComplete($isComplete)
  993.     {
  994.         $this->isComplete $isComplete;
  995.         return $this;
  996.     }
  997.     /**
  998.      * Get isComplete
  999.      *
  1000.      * @return boolean
  1001.      */
  1002.     public function getIsComplete()
  1003.     {
  1004.         return $this->isComplete;
  1005.     }
  1006.     /**
  1007.      * Set cguAt
  1008.      *
  1009.      * @param  datetime $cguAt
  1010.      */
  1011.     public function setCguAt($cguAt)
  1012.     {
  1013.         $this->cguAt $cguAt;
  1014.         return $this;
  1015.     }
  1016.     /**
  1017.      * Get cguAt
  1018.      *
  1019.      * @return string
  1020.      */
  1021.     public function getCguAt()
  1022.     {
  1023.         return $this->cguAt;
  1024.     }
  1025.     public function hasSocialNetworks()
  1026.     {
  1027.         if($this->facebookUrl != "" || $this->instagramUrl != "" || $this->twitterUrl != ""
  1028.             || $this->youtubeUrl != "") {
  1029.             return true;
  1030.         }
  1031.         return false;
  1032.     }
  1033.     public function getPageAdhesion()
  1034.     {
  1035.         foreach($this->pages as $page) {
  1036.             if($page->getIsAdhesion() === true) {
  1037.                 return $page;
  1038.             }
  1039.         }
  1040.     }
  1041.     public function setAuthenticationToken($token)
  1042.     {
  1043.         $this->authenticationToken $token;
  1044.     }
  1045.     public function getAuthenticationToken()
  1046.     {
  1047.         return $this->authenticationToken;
  1048.     }
  1049.     public function generateAndSetAuthenticationToken()
  1050.     {
  1051.         $this->authenticationToken sha1(uniqid().random_int(10000,90000).$this->email.time());
  1052.     }
  1053.     public function getResponsableLastname(): ?string
  1054.     {
  1055.         return $this->responsableLastname;
  1056.     }
  1057.     public function setResponsableLastname(?string $responsableLastname): self
  1058.     {
  1059.         $this->responsableLastname $responsableLastname;
  1060.         return $this;
  1061.     }
  1062.     public function getResponsableFirstname(): ?string
  1063.     {
  1064.         return $this->responsableFirstname;
  1065.     }
  1066.     public function setResponsableFirstname(?string $responsableFirstname): self
  1067.     {
  1068.         $this->responsableFirstname $responsableFirstname;
  1069.         return $this;
  1070.     }
  1071.     public function getResponsableEmail(): ?string
  1072.     {
  1073.         return $this->responsableEmail;
  1074.     }
  1075.     public function setResponsableEmail(?string $responsableEmail): self
  1076.     {
  1077.         $this->responsableEmail $responsableEmail;
  1078.         return $this;
  1079.     }
  1080.     public function getClubResponsable(): ?string
  1081.     {
  1082.         return $this->clubResponsable;
  1083.     }
  1084.     public function setClubResponsable(?string $clubResponsable): self
  1085.     {
  1086.         $this->clubResponsable $clubResponsable;
  1087.         return $this;
  1088.     }
  1089.     public function getNewsPosition(): ?int
  1090.     {
  1091.         return $this->newsPosition;
  1092.     }
  1093.     public function setNewsPosition(?int $newsPosition): self
  1094.     {
  1095.         $this->newsPosition $newsPosition;
  1096.         return $this;
  1097.     }
  1098.     public function isNewsVisible(): ?bool
  1099.     {
  1100.         return $this->newsVisible;
  1101.     }
  1102.     public function setNewsVisible(bool $newsVisible): self
  1103.     {
  1104.         $this->newsVisible $newsVisible;
  1105.         return $this;
  1106.     }
  1107.     public function getEventPosition(): ?int
  1108.     {
  1109.         return $this->eventPosition;
  1110.     }
  1111.     public function setEventPosition(?int $eventPosition): self
  1112.     {
  1113.         $this->eventPosition $eventPosition;
  1114.         return $this;
  1115.     }
  1116.     public function isEventVisible(): ?bool
  1117.     {
  1118.         return $this->eventVisible;
  1119.     }
  1120.     public function setEventVisible(bool $eventVisible): self
  1121.     {
  1122.         $this->eventVisible $eventVisible;
  1123.         return $this;
  1124.     }
  1125.     public function getGalleryPosition(): ?int
  1126.     {
  1127.         return $this->galleryPosition;
  1128.     }
  1129.     public function setGalleryPosition(?int $galleryPosition): self
  1130.     {
  1131.         $this->galleryPosition $galleryPosition;
  1132.         return $this;
  1133.     }
  1134.     public function isGalleryVisible(): ?bool
  1135.     {
  1136.         return $this->galleryVisible;
  1137.     }
  1138.     public function setGalleryVisible(bool $galleryVisible): self
  1139.     {
  1140.         $this->galleryVisible $galleryVisible;
  1141.         return $this;
  1142.     }
  1143.     public function getFixedMenuWithPositions(): array
  1144.     {
  1145.         $positions = [];
  1146.         if ($this->isNewsVisible()) {
  1147.             $positions[$this->getNewsPosition()] = ['title' => 'actualités''route' => 'news'];
  1148.         }
  1149.         if ($this->isEventVisible()) {
  1150.             $positions[$this->getEventPosition()] = ['title' => 'événements''route' => 'events'];
  1151.         }
  1152.         if ($this->isGalleryVisible()) {
  1153.             $positions[$this->getGalleryPosition()] = ['title' => 'galeries''route' => 'galleries'];
  1154.         }
  1155.         ksort($positions);
  1156.         return $positions;
  1157.     }
  1158.     /**
  1159.      * @param File $picture
  1160.      */
  1161.     public function setPicture($picture)
  1162.     {
  1163.         $this->picture $picture;
  1164.         if ($picture instanceof File) {
  1165.             $this->updatedAt = new \DateTime('now');
  1166.         }
  1167.     }
  1168.     /**
  1169.      * @return File
  1170.      */
  1171.     public function getPicture()
  1172.     {
  1173.         return $this->picture;
  1174.     }
  1175.     /**
  1176.      * @param string $pictureName
  1177.      */
  1178.     public function setPictureName($pictureName)
  1179.     {
  1180.         $this->pictureName $pictureName;
  1181.     }
  1182.     /**
  1183.      * @return string
  1184.      */
  1185.     public function getPictureName()
  1186.     {
  1187.         return $this->pictureName;
  1188.     }
  1189. }