src/Entity/Event/EventClub.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Event;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. use Symfony\Component\HttpFoundation\File\UploadedFile;
  6. use Symfony\Component\Filesystem\Filesystem;
  7. /**
  8.  * EventClub
  9.  *
  10.  * @ORM\Table(name="tam_event_club")
  11.  * @ORM\Entity(repositoryClass="App\Repository\Event\EventClubRepository")
  12.  */
  13. class EventClub
  14. {
  15.     /**
  16.      * @var int
  17.      *
  18.      * @ORM\Column(name="id", type="integer")
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="IDENTITY")
  21.      */
  22.     private $id;
  23.     
  24.     /**
  25.      * @var \App\Entity\Club\Club
  26.      *
  27.      * @ORM\ManyToOne(targetEntity="\App\Entity\Club\Club", fetch="EAGER", inversedBy="events")
  28.      * @ORM\JoinColumns({
  29.      *   @ORM\JoinColumn(name="club", referencedColumnName="id", onDelete="SET NULL")
  30.      * })
  31.      */
  32.     private $club;
  33.     
  34.     /**
  35.      * @var \App\Entity\Event\EventType
  36.      *
  37.      * @ORM\ManyToOne(targetEntity="\App\Entity\Event\EventType", fetch="EAGER", inversedBy="clubEvents")
  38.      * @ORM\JoinColumns({
  39.      *   @ORM\JoinColumn(name="event_type", referencedColumnName="id", onDelete="SET NULL")
  40.      * })
  41.      */
  42.     private $eventType;
  43.     
  44.     /**
  45.      * @var string
  46.      *
  47.      * @ORM\Column(name="title", type="string", length=255, nullable=true)
  48.      */
  49.     private $title;
  50.     
  51.     /**
  52.      * @var string
  53.      *
  54.      * @ORM\Column(name="description", type="text", nullable=true)
  55.      */
  56.     private $description;
  57.     
  58.     /**
  59.      * @var \DateTime
  60.      *
  61.      * @ORM\Column(name="date_begin", type="datetime", nullable=false)
  62.      */
  63.     private $dateBegin;
  64.     
  65.     /**
  66.      * @var \DateTime
  67.      *
  68.      * @ORM\Column(name="date_end", type="datetime", nullable=false)
  69.      */
  70.     private $dateEnd;
  71.     
  72.     /**
  73.      * @var string
  74.      *
  75.      * @ORM\Column(name="place_name", type="string", length=255, nullable=true)
  76.      */
  77.     private $placeName;
  78.     
  79.     /**
  80.      * @var string
  81.      *
  82.      * @ORM\Column(name="place_address", type="string", length=255, nullable=true)
  83.      */
  84.     private $placeAddress;
  85.     
  86.     /**
  87.      * @var string
  88.      *
  89.      * @ORM\Column(name="place_zipcode", type="string", length=255, nullable=true)
  90.      */
  91.     private $placeZipcode;
  92.     
  93.     /**
  94.      * @var string
  95.      *
  96.      * @ORM\Column(name="place_city", type="string", length=255, nullable=true)
  97.      */
  98.     private $placeCity;
  99.     
  100.     /**
  101.      * @var string
  102.      *
  103.      * @ORM\Column(name="place_country", type="string", length=255, nullable=true)
  104.      */
  105.     private $placeCountry;
  106.     
  107.     /**
  108.      * @var string
  109.      *
  110.      * @ORM\Column(name="lat", type="decimal", precision=10, scale=0, nullable=true)
  111.      */
  112.     private $lat;
  113.     /**
  114.      * @var string
  115.      *
  116.      * @ORM\Column(name="lng", type="decimal", precision=10, scale=0, nullable=true)
  117.      */
  118.     private $lng;
  119.     
  120.     /**
  121.      * @var \App\Entity\Surface
  122.      *
  123.      * @ORM\ManyToOne(targetEntity="\App\Entity\Surface", fetch="EAGER", inversedBy="events")
  124.      * @ORM\JoinColumns({
  125.      *   @ORM\JoinColumn(name="surface", referencedColumnName="id", onDelete="SET NULL")
  126.      * })
  127.      */
  128.     private $surface;
  129.     
  130.     /**
  131.      * @var boolean
  132.      *
  133.      * @ORM\Column(name="clubhouse", type="boolean", options={"default": FALSE})
  134.      */
  135.     private $clubhouse;
  136.     
  137.     /**
  138.      * @var boolean
  139.      *
  140.      * @ORM\Column(name="lockerroom", type="boolean", options={"default": FALSE})
  141.      */
  142.     private $lockerroom;
  143.     
  144.     /**
  145.      * @var string
  146.      *
  147.      * @ORM\Column(name="contact_name", type="string", length=255, nullable=true)
  148.      */
  149.     private $contactName;
  150.     
  151.     /**
  152.      * @var string
  153.      *
  154.      * @ORM\Column(name="contact_address", type="string", length=255, nullable=true)
  155.      */
  156.     private $contactAddress;
  157.     
  158.     /**
  159.      * @var string
  160.      *
  161.      * @ORM\Column(name="contact_zipcode", type="string", length=255, nullable=true)
  162.      */
  163.     private $contactZipcode;
  164.     
  165.     /**
  166.      * @var string
  167.      *
  168.      * @ORM\Column(name="contact_city", type="string", length=255, nullable=true)
  169.      */
  170.     private $contactCity;
  171.     
  172.     /**
  173.      * @var string
  174.      *
  175.      * @ORM\Column(name="contact_country", type="string", length=255, nullable=true)
  176.      */
  177.     private $contactCountry;
  178.     
  179.     /**
  180.      * @var string
  181.      *
  182.      * @ORM\Column(name="contact_phone", type="string", length=255, nullable=true)
  183.      */
  184.     private $contactPhone;
  185.     
  186.     /**
  187.      * @var string
  188.      *
  189.      * @ORM\Column(name="contact_mobile", type="string", length=255, nullable=true)
  190.      */
  191.     private $contactMobile;
  192.     
  193.     /**
  194.      * @var string
  195.      *
  196.      * @ORM\Column(name="contact_email", type="string", length=255, nullable=true)
  197.      */
  198.     private $contactEmail;
  199.     
  200.     /**
  201.      * @var \DateTime
  202.      *
  203.      * @ORM\Column(name="date_created", type="datetime", nullable=false)
  204.      */
  205.     private $dateCreated;
  206.     
  207.     /**
  208.      * @var \DateTime
  209.      *
  210.      * @ORM\Column(name="date_updated", type="datetime", nullable=true)
  211.      */
  212.     private $dateUpdated;
  213.     
  214.     /**
  215.      * @var boolean
  216.      *
  217.      * @ORM\Column(name="active", type="boolean", options={"default": FALSE})
  218.      */
  219.     private $active;
  220.     
  221.     /**
  222.      * @var string
  223.      *
  224.      * @ORM\Column(name="illustration", type="string", length=255, nullable=true)
  225.      */
  226.     private $illustration;
  227.     
  228.      /**
  229.      * Image illustrationFile
  230.      *
  231.      * @var File
  232.      *
  233.      * @Assert\File(
  234.      *     maxSize = "5M",
  235.      *     mimeTypes = {"image/jpeg", "image/gif", "image/png", "image/tiff"},
  236.      *     maxSizeMessage = "The maxmimum allowed file size is 5MB.",
  237.      *     mimeTypesMessage = "Only the filetypes image are allowed."
  238.      * )
  239.      */
  240.     protected $illustrationFile;
  241.     
  242.     
  243.     public function __construct()
  244.     {
  245.         $this->active true;
  246.         $this->dateCreated = new \DateTime();
  247.         $this->dateUpdated = new \DateTime();
  248.         $this->illustrationFile null;
  249.     }
  250.     /**
  251.      * Get id
  252.      *
  253.      * @return int
  254.      */
  255.     public function getId()
  256.     {
  257.         return $this->id;
  258.     }
  259.     
  260.     /**
  261.      * Set club
  262.      *
  263.      * @param RankingSystem $club
  264.      *
  265.      * @return EventClub
  266.      */
  267.     public function setClub($club)
  268.     {
  269.         $this->club $club;
  270.         return $this;
  271.     }
  272.     /**
  273.      * Get club
  274.      *
  275.      * @return Club
  276.      */
  277.     public function getClub()
  278.     {
  279.         return $this->club;
  280.     }
  281.     
  282.     /**
  283.      * Set eventType
  284.      *
  285.      * @param RankingSystem $eventType
  286.      *
  287.      * @return EventClub
  288.      */
  289.     public function setEventType($eventType)
  290.     {
  291.         $this->eventType $eventType;
  292.         return $this;
  293.     }
  294.     /**
  295.      * Get eventType
  296.      *
  297.      * @return EventType
  298.      */
  299.     public function getEventType()
  300.     {
  301.         return $this->eventType;
  302.     }
  303.     
  304.     /**
  305.      * Set title
  306.      *
  307.      * @param string $title
  308.      *
  309.      * @return EventClub
  310.      */
  311.     public function setTitle($title)
  312.     {
  313.         $this->title $title;
  314.         return $this;
  315.     }
  316.     /**
  317.      * Get title
  318.      *
  319.      * @return string
  320.      */
  321.     public function getTitle()
  322.     {
  323.         return $this->title;
  324.     }
  325.     
  326.     /**
  327.      * Set description
  328.      *
  329.      * @param string $description
  330.      *
  331.      * @return EventClub
  332.      */
  333.     public function setDescription($description)
  334.     {
  335.         $this->description $description;
  336.         return $this;
  337.     }
  338.     /**
  339.      * Get description
  340.      *
  341.      * @return string
  342.      */
  343.     public function getDescription()
  344.     {
  345.         return $this->description;
  346.     }
  347.     
  348.     /**
  349.      * Set dateBegin
  350.      *
  351.      * @param \DateTime $dateBegin
  352.      *
  353.      * @return EventClub
  354.      */
  355.     public function setDateBegin($dateBegin)
  356.     {
  357.         $this->dateBegin $dateBegin;
  358.         return $this;
  359.     }
  360.     /**
  361.      * Get dateBegin
  362.      *
  363.      * @return \DateTime
  364.      */
  365.     public function getDateBegin()
  366.     {
  367.         return $this->dateBegin;
  368.     }
  369.     
  370.     /**
  371.      * Set dateEnd
  372.      *
  373.      * @param \DateTime $dateEnd
  374.      *
  375.      * @return EventClub
  376.      */
  377.     public function setDateEnd($dateEnd)
  378.     {
  379.         $this->dateEnd $dateEnd;
  380.         return $this;
  381.     }
  382.     /**
  383.      * Get dateEnd
  384.      *
  385.      * @return \DateTime
  386.      */
  387.     public function getDateEnd()
  388.     {
  389.         return $this->dateEnd;
  390.     }
  391.     
  392.     /**
  393.      * Set placeName
  394.      *
  395.      * @param string $placeName
  396.      *
  397.      * @return EventClub
  398.      */
  399.     public function setPlaceName($placeName)
  400.     {
  401.         $this->placeName $placeName;
  402.         return $this;
  403.     }
  404.     /**
  405.      * Get placeName
  406.      *
  407.      * @return string
  408.      */
  409.     public function getPlaceName()
  410.     {
  411.         return $this->placeName;
  412.     }
  413.     
  414.     /**
  415.      * Set placeAddress
  416.      *
  417.      * @param string $placeAddress
  418.      *
  419.      * @return EventClub
  420.      */
  421.     public function setPlaceAddress($placeAddress)
  422.     {
  423.         $this->placeAddress $placeAddress;
  424.         return $this;
  425.     }
  426.     /**
  427.      * Get placeAddress
  428.      *
  429.      * @return string
  430.      */
  431.     public function getPlaceAddress()
  432.     {
  433.         return $this->placeAddress;
  434.     }
  435.     
  436.     /**
  437.      * Set placeZipcode
  438.      *
  439.      * @param string $placeZipcode
  440.      *
  441.      * @return EventClub
  442.      */
  443.     public function setPlaceZipcode($placeZipcode)
  444.     {
  445.         $this->placeZipcode $placeZipcode;
  446.         return $this;
  447.     }
  448.     /**
  449.      * Get placeZipcode
  450.      *
  451.      * @return string
  452.      */
  453.     public function getPlaceZipcode()
  454.     {
  455.         return $this->placeZipcode;
  456.     }
  457.     
  458.     /**
  459.      * Set placeCity
  460.      *
  461.      * @param string $placeCity
  462.      *
  463.      * @return EventClub
  464.      */
  465.     public function setPlaceCity($placeCity)
  466.     {
  467.         $this->placeCity $placeCity;
  468.         return $this;
  469.     }
  470.     /**
  471.      * Get placeCity
  472.      *
  473.      * @return string
  474.      */
  475.     public function getPlaceCity()
  476.     {
  477.         return $this->placeCity;
  478.     }
  479.     
  480.     /**
  481.      * Set placeCountry
  482.      *
  483.      * @param string $placeCountry
  484.      *
  485.      * @return EventClub
  486.      */
  487.     public function setPlaceCountry($placeCountry)
  488.     {
  489.         $this->placeCountry $placeCountry;
  490.         return $this;
  491.     }
  492.     /**
  493.      * Get placeCountry
  494.      *
  495.      * @return string
  496.      */
  497.     public function getPlaceCountry()
  498.     {
  499.         return $this->placeCountry;
  500.     }
  501.     
  502.     /**
  503.      * Set lat
  504.      *
  505.      * @param string $lat
  506.      * @return EventClub
  507.      */
  508.     public function setLat($lat)
  509.     {
  510.         $this->lat $lat;
  511.         return $this;
  512.     }
  513.     /**
  514.      * Get lat
  515.      *
  516.      * @return string 
  517.      */
  518.     public function getLat()
  519.     {
  520.         return $this->lat;
  521.     }
  522.     /**
  523.      * Set lng
  524.      *
  525.      * @param string $lng
  526.      * @return EventClub
  527.      */
  528.     public function setLng($lng)
  529.     {
  530.         $this->lng $lng;
  531.         return $this;
  532.     }
  533.     /**
  534.      * Get lng
  535.      *
  536.      * @return string 
  537.      */
  538.     public function getLng()
  539.     {
  540.         return $this->lng;
  541.     }
  542.     
  543.     /**
  544.      * Set surface
  545.      *
  546.      * @param Surface $surface
  547.      *
  548.      * @return EventClub
  549.      */
  550.     public function setSurface($surface)
  551.     {
  552.         $this->surface $surface;
  553.         return $this;
  554.     }
  555.     /**
  556.      * Get surface
  557.      *
  558.      * @return Surface
  559.      */
  560.     public function getSurface()
  561.     {
  562.         return $this->surface;
  563.     }
  564.     
  565.     /**
  566.      * Set clubhouse
  567.      *
  568.      * @param boolean $clubhouse
  569.      *
  570.      * @return EventClub
  571.      */
  572.     public function setClubhouse($clubhouse)
  573.     {
  574.         $this->clubhouse $clubhouse;
  575.         return $this;
  576.     }
  577.     /**
  578.      * Get clubhouse
  579.      *
  580.      * @return boolean
  581.      */
  582.     public function getClubhouse()
  583.     {
  584.         return $this->clubhouse;
  585.     }
  586.     
  587.     /**
  588.      * Set lockerroom
  589.      *
  590.      * @param boolean $lockerroom
  591.      *
  592.      * @return EventClub
  593.      */
  594.     public function setLockerroom($lockerroom)
  595.     {
  596.         $this->lockerroom $lockerroom;
  597.         return $this;
  598.     }
  599.     /**
  600.      * Get lockerroom
  601.      *
  602.      * @return boolean
  603.      */
  604.     public function getLockerroom()
  605.     {
  606.         return $this->lockerroom;
  607.     }
  608.     
  609.     /**
  610.      * Set contactName
  611.      *
  612.      * @param string $contactName
  613.      *
  614.      * @return EventClub
  615.      */
  616.     public function setContactName($contactName)
  617.     {
  618.         $this->contactName $contactName;
  619.         return $this;
  620.     }
  621.     /**
  622.      * Get contactName
  623.      *
  624.      * @return string
  625.      */
  626.     public function getContactName()
  627.     {
  628.         return $this->contactName;
  629.     }
  630.     
  631.     /**
  632.      * Set contactAddress
  633.      *
  634.      * @param string $contactAddress
  635.      *
  636.      * @return EventClub
  637.      */
  638.     public function setContactAddress($contactAddress)
  639.     {
  640.         $this->contactAddress $contactAddress;
  641.         return $this;
  642.     }
  643.     /**
  644.      * Get contactAddress
  645.      *
  646.      * @return string
  647.      */
  648.     public function getContactAddress()
  649.     {
  650.         return $this->contactAddress;
  651.     }
  652.     
  653.     /**
  654.      * Set contactZipcode
  655.      *
  656.      * @param string $contactZipcode
  657.      *
  658.      * @return EventClub
  659.      */
  660.     public function setContactZipcode($contactZipcode)
  661.     {
  662.         $this->contactZipcode $contactZipcode;
  663.         return $this;
  664.     }
  665.     /**
  666.      * Get contactZipcode
  667.      *
  668.      * @return string
  669.      */
  670.     public function getContactZipcode()
  671.     {
  672.         return $this->contactZipcode;
  673.     }
  674.     
  675.     /**
  676.      * Set contactCity
  677.      *
  678.      * @param string $contactCity
  679.      *
  680.      * @return EventClub
  681.      */
  682.     public function setContactCity($contactCity)
  683.     {
  684.         $this->contactCity $contactCity;
  685.         return $this;
  686.     }
  687.     /**
  688.      * Get contactCity
  689.      *
  690.      * @return string
  691.      */
  692.     public function getContactCity()
  693.     {
  694.         return $this->contactCity;
  695.     }
  696.     
  697.     /**
  698.      * Set contactCountry
  699.      *
  700.      * @param string $contactCountry
  701.      *
  702.      * @return EventClub
  703.      */
  704.     public function setContactCountry($contactCountry)
  705.     {
  706.         $this->contactCountry $contactCountry;
  707.         return $this;
  708.     }
  709.     /**
  710.      * Get contactCountry
  711.      *
  712.      * @return string
  713.      */
  714.     public function getContactCountry()
  715.     {
  716.         return $this->contactCountry;
  717.     }
  718.     
  719.     /**
  720.      * Set contactPhone
  721.      *
  722.      * @param string $contactPhone
  723.      *
  724.      * @return EventClub
  725.      */
  726.     public function setContactPhone($contactPhone)
  727.     {
  728.         $this->contactPhone $contactPhone;
  729.         return $this;
  730.     }
  731.     /**
  732.      * Get contactPhone
  733.      *
  734.      * @return string
  735.      */
  736.     public function getContactPhone()
  737.     {
  738.         return $this->contactPhone;
  739.     }
  740.     
  741.     /**
  742.      * Set contactMobile
  743.      *
  744.      * @param string $contactMobile
  745.      *
  746.      * @return EventClub
  747.      */
  748.     public function setContactMobile($contactMobile)
  749.     {
  750.         $this->contactMobile $contactMobile;
  751.         return $this;
  752.     }
  753.     /**
  754.      * Get contactMobile
  755.      *
  756.      * @return string
  757.      */
  758.     public function getContactMobile()
  759.     {
  760.         return $this->contactMobile;
  761.     }
  762.     
  763.     /**
  764.      * Set contactEmail
  765.      *
  766.      * @param string $contactEmail
  767.      *
  768.      * @return EventClub
  769.      */
  770.     public function setContactEmail($contactEmail)
  771.     {
  772.         $this->contactEmail $contactEmail;
  773.         return $this;
  774.     }
  775.     /**
  776.      * Get contactEmail
  777.      *
  778.      * @return string
  779.      */
  780.     public function getContactEmail()
  781.     {
  782.         return $this->contactEmail;
  783.     }
  784.     
  785.     /**
  786.      * Set dateCreated
  787.      *
  788.      * @param \DateTime $dateCreated
  789.      *
  790.      * @return EventClub
  791.      */
  792.     public function setDateCreated($dateCreated)
  793.     {
  794.         $this->dateCreated $dateCreated;
  795.         return $this;
  796.     }
  797.     /**
  798.      * Get dateCreated
  799.      *
  800.      * @return \DateTime
  801.      */
  802.     public function getDateCreated()
  803.     {
  804.         return $this->dateCreated;
  805.     }
  806.     
  807.     /**
  808.      * Set dateUpdated
  809.      *
  810.      * @param \DateTime $dateUpdated
  811.      *
  812.      * @return EventClub
  813.      */
  814.     public function setDateUpdated($dateUpdated)
  815.     {
  816.         $this->dateUpdated $dateUpdated;
  817.         return $this;
  818.     }
  819.     /**
  820.      * Get dateUpdated
  821.      *
  822.      * @return \DateTime
  823.      */
  824.     public function getDateUpdated()
  825.     {
  826.         return $this->dateUpdated;
  827.     }
  828.     
  829.      /**
  830.      * Set active
  831.      *
  832.      * @param boolean $active
  833.      *
  834.      * @return EventClub
  835.      */
  836.     public function setActive($active)
  837.     {
  838.         $this->active $active;
  839.         return $this;
  840.     }
  841.     /**
  842.      * Get active
  843.      *
  844.      * @return boolean
  845.      */
  846.     public function getActive()
  847.     {
  848.         return $this->active;
  849.     }
  850.     
  851.     
  852.     /**
  853.      * Set illustration
  854.      *
  855.      * @param string $illustration
  856.      *
  857.      * @return EventClub
  858.      */
  859.     public function setIllustration($illustration)
  860.     {
  861.         $this->illustration $illustration;
  862.         return $this;
  863.     }
  864.     /**
  865.      * Get illustration
  866.      *
  867.      * @return string
  868.      */
  869.     public function getIllustration()
  870.     {
  871.         return $this->illustration;
  872.     }
  873.     
  874.     
  875.     public function getLinkIllustration()
  876.     {
  877.         if($this->getIllustration()){
  878.             if(file_exists($this->getUploadIllustrationRootDir().$this->getIllustration()))
  879.                 return $this->getIllustrationDir().$this->getIllustration();
  880.             else
  881.                 return null;
  882.         }else{
  883.             return null;
  884.         }
  885.     }
  886.     
  887.     public function getAbsolutePathIllustration()
  888.     {
  889.         if($this->getIllustration()){
  890.             if(file_exists($this->getUploadIllustrationRootDir().$this->getIllustration()))
  891.                 return $this->getUploadIllustrationRootDir().$this->getIllustrationPath();
  892.             else
  893.                 return null;
  894.         }else{
  895.             return null;
  896.         }
  897.     }
  898.     
  899.     
  900.     /**
  901.      * Sets avatarFile.
  902.      *
  903.      * @param UploadedFile $file
  904.      */
  905.     public function setIllustrationFile(UploadedFile $file null)
  906.     {
  907.         $this->illustrationFile $file;
  908.     }
  909.     
  910.     /**
  911.      * Get illustrationFile.
  912.      *
  913.      * @return UploadedFile
  914.      */
  915.     public function getIllustrationFile()
  916.     {
  917.         return $this->IllustrationFile;
  918.     }
  919.     
  920.     
  921.     /***********************
  922.      * Lifecycle Callbacks
  923.      ***********************/
  924.     /**
  925.      *
  926.      * @ORM\PrePersist()
  927.      * @ORM\PreUpdate()
  928.      */
  929.     public function UpdateDate()
  930.     {
  931.         $this->setDateUpdated(new \DateTime());
  932.         
  933.     }
  934.     
  935.     /**
  936.      * Called before saving the entity
  937.      * 
  938.      * @ORM\PrePersist()
  939.      * @ORM\PreUpdate()
  940.      */
  941.     public function preUpload()
  942.     {   
  943.         if (null !== $this->avatarFile) {
  944.             // do whatever you want to generate a unique name
  945.             $filename sha1(uniqid(mt_rand(), true));
  946.             $this->illustration $filename.'.'.$this->illustrationFile->guessExtension();
  947.             $this->setDateUpdated(new \DateTime());
  948.         }
  949.     }
  950.     
  951.     /**
  952.      * Called before entity removal
  953.      *
  954.      * @ORM\PreRemove()
  955.      */
  956.     public function removeUpload()
  957.     {
  958.         if ($file $this->getAbsolutePathAvatar()) {
  959.             unlink($file); 
  960.         }
  961.     }
  962.     
  963.     /**
  964.      * Called after entity persistence
  965.      *
  966.      * @ORM\PostPersist()
  967.      * @ORM\PostUpdate()
  968.      */
  969.     public function upload()
  970.     {
  971.         // The file property can be empty if the field is not required
  972.         if (null === $this->illustrationFile) {
  973.             return;
  974.         }
  975.     
  976.         // Use the original file name here but you should
  977.         // sanitize it at least to avoid any security issues
  978.     
  979.         // move takes the target directory and then the
  980.         // target filename to move to
  981.         $this->illustrationFile->move(
  982.             $this->getUploadAvatarRootDir(),
  983.             $this->illustration
  984.         );
  985.     
  986.         // Set the path property to the filename where you've saved the file
  987.         //$this->path = $this->file->getClientOriginalName();
  988.     
  989.         // Clean up the file property as you won't need it anymore
  990.         $this->illustrationFile null;
  991.     }
  992.     
  993.     
  994.     
  995.     
  996.     
  997.     /***********************
  998.      * OTHER FUNCTION
  999.      ***********************/
  1000.     
  1001.     
  1002.     public function getUploadIllustrationRootDir(){
  1003.         
  1004.         $logoDir __DIR__ '/../../../web/club/'.$this->getClub()->getId().'/events/';
  1005.         
  1006.         $fs = new Filesystem();
  1007.         if ($fs->exists($logoDir) == false) {
  1008.                 $fs->mkdir($logoDir);
  1009.         }
  1010.         
  1011.         return $logoDir;
  1012.     }
  1013.     
  1014.     public function getIllustrationDir()
  1015.     {
  1016.         return 'club/'.$this->getClub()->getId().'/events/';
  1017.     }
  1018.     
  1019.     
  1020. }