src/Entity/Structures.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * Pages
  8.  *
  9.  * @ORM\Table(name="Structures")
  10.  * @ORM\Entity(repositoryClass="App\Repository\StructuresRepository")
  11.  */
  12. class Structures
  13. {
  14.     public function __construct(){
  15.                                                $this->date = new \DateTime;
  16.                                                $this->projects = new ArrayCollection();
  17.                                            }
  18.     /**
  19.      * @var int
  20.      *
  21.      * @ORM\Column(name="id", type="integer")
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue(strategy="AUTO")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @var string
  28.      *
  29.      * @ORM\Column(name="position", type="integer", nullable=true)
  30.      */
  31.     private $position;
  32.     /**
  33.      * @var string
  34.      *
  35.      * @ORM\Column(name="name", type="string", length=255,nullable=true)
  36.      */
  37.     private $name;
  38.     /**
  39.      * @var string
  40.      *
  41.      * @ORM\Column(name="abbreviation", type="string", length=255,nullable=true)
  42.      */
  43.     private $abbreviation;
  44.     /**
  45.      * @ORM\OneToOne(targetEntity="App\Entity\Picture", cascade={"persist","remove"}, orphanRemoval=true)
  46.      * @ORM\JoinColumn(nullable=true)
  47.      */
  48.     private $logo;
  49.     /**
  50.      * @var string
  51.      *
  52.      * @ORM\Column(type="string", length=255,nullable=true)
  53.      */
  54.     private $director;
  55.     /**
  56.      * @ORM\OneToOne(targetEntity="App\Entity\Picture", cascade={"persist","remove"}, orphanRemoval=true)
  57.      * @ORM\JoinColumn(nullable=true)
  58.      */
  59.     private $directorPicture;
  60.     /**
  61.      * @var string
  62.      *
  63.      * @ORM\Column(type="string", length=255,nullable=true)
  64.      */
  65.     private $address;
  66.     /**
  67.      * @var string
  68.      *
  69.      * @ORM\Column(type="string", length=255,nullable=true)
  70.      */
  71.     private $phone;
  72.     /**
  73.      * @var string
  74.      *
  75.      * @ORM\Column(type="string", length=255,nullable=true)
  76.      */
  77.     private $email;
  78.     /**
  79.      * @var string
  80.      *
  81.      * @ORM\Column(type="string", length=255,nullable=true)
  82.      */
  83.     private $website;
  84.     /**
  85.      * @var string
  86.      *
  87.      * @ORM\Column(type="string", length=255,nullable=true)
  88.      */
  89.     private $map;
  90.     /**
  91.      * @var string
  92.      *
  93.      * @ORM\Column(name="description", type="text", nullable=true)
  94.      */
  95.     private $description;
  96.     /**
  97.      * @var string
  98.      *
  99.      * @ORM\Column(name="content", type="text",nullable=true)
  100.      */
  101.     private $content;
  102.     /**
  103.      * @var \DateTime|null
  104.      *
  105.      * @ORM\Column(name="date", type="datetime", nullable=true)
  106.      */
  107.     private $date;
  108.     /**
  109.      * @ORM\ManyToOne(targetEntity="App\Entity\Users")
  110.      * @ORM\JoinColumn(name="createdBy",nullable=true)
  111.      */
  112.     private $createdBy;
  113.     /**
  114.      * @ORM\ManyToOne(targetEntity="App\Entity\Users")
  115.      * @ORM\JoinColumn(name="updatedBy",nullable=true)
  116.      */
  117.     private $updatedBy;
  118.     /**
  119.      * @var bool
  120.      *
  121.      * @ORM\Column(name="isEnabled", type="boolean",nullable=true)
  122.      */
  123.     private $isEnabled;
  124.     /**
  125.      * @ORM\ManyToOne(targetEntity=StructuresCategories::class, inversedBy="structures", fetch="EAGER")
  126.      * @ORM\JoinColumn(nullable=true)
  127.      */
  128.     private $category;
  129.     /**
  130.      * @ORM\Column(type="string", length=255, nullable=true)
  131.      */
  132.     private $slug;
  133.     /**
  134.      * @ORM\ManyToOne(targetEntity=Sectors::class, inversedBy="structures")
  135.      */
  136.     private $sector;
  137.     /**
  138.      * @ORM\OneToMany(targetEntity=Projects::class, mappedBy="structure")
  139.      */
  140.     private $projects;
  141.     public function getId(): ?int
  142.     {
  143.         return $this->id;
  144.     }
  145.     public function getName(): ?string
  146.     {
  147.         return $this->name;
  148.     }
  149.     public function setName(?string $name): self
  150.     {
  151.         $this->name $name;
  152.         return $this;
  153.     }
  154.     public function getPosition(): ?int
  155.     {
  156.         return $this->position;
  157.     }
  158.     public function setPosition(?int $position): self
  159.     {
  160.         $this->position $position;
  161.         return $this;
  162.     }
  163.     public function getAbbreviation(): ?string
  164.     {
  165.         return $this->abbreviation;
  166.     }
  167.     public function setAbbreviation(?string $abbreviation): self
  168.     {
  169.         $this->abbreviation $abbreviation;
  170.         return $this;
  171.     }
  172.     public function getDirector(): ?string
  173.     {
  174.         return $this->director;
  175.     }
  176.     public function setDirector(?string $director): self
  177.     {
  178.         $this->director $director;
  179.         return $this;
  180.     }
  181.     public function getDirectorPicture(): ?Picture
  182.     {
  183.         return $this->directorPicture;
  184.     }
  185.     public function setDirectorPicture(?Picture $directorPicture): self
  186.     {
  187.         if($directorPicture->getTarget()){
  188.             $this->directorPicture $directorPicture;
  189.             $this->directorPicture->setDir('upload/images/structures');
  190.             $this->directorPicture->setThumbnailDir('upload/thumbnails/structures');
  191.         }
  192.         return $this;
  193.     }
  194.     public function getDescription(): ?string
  195.     {
  196.         return $this->description;
  197.     }
  198.     public function setDescription(?string $description): self
  199.     {
  200.         $this->description $description;
  201.         return $this;
  202.     }
  203.     public function getAddress(): ?string
  204.     {
  205.         return $this->address;
  206.     }
  207.     public function setAddress(?string $address): self
  208.     {
  209.         $this->address $address;
  210.         return $this;
  211.     }
  212.     public function getPhone(): ?string
  213.     {
  214.         return $this->phone;
  215.     }
  216.     public function setPhone(?string $phone): self
  217.     {
  218.         $this->phone $phone;
  219.         return $this;
  220.     }
  221.     public function getEmail(): ?string
  222.     {
  223.         return $this->email;
  224.     }
  225.     public function setEmail(?string $email): self
  226.     {
  227.         $this->email $email;
  228.         return $this;
  229.     }
  230.     public function getWebsite(): ?string
  231.     {
  232.         return $this->website;
  233.     }
  234.     public function setWebsite(?string $website): self
  235.     {
  236.         $this->website $website;
  237.         return $this;
  238.     }
  239.     public function getMap(): ?string
  240.     {
  241.         return $this->map;
  242.     }
  243.     public function setMap(?string $map): self
  244.     {
  245.         $this->map $map;
  246.         return $this;
  247.     }
  248.     public function getLastUpdate(): ?\DateTimeInterface
  249.     {
  250.         return $this->lastUpdate;
  251.     }
  252.     public function setLastUpdate(\DateTimeInterface $lastUpdate): self
  253.     {
  254.         $this->lastUpdate $lastUpdate;
  255.         return $this;
  256.     }
  257.     public function getDate(): ?\DateTimeInterface
  258.     {
  259.         return $this->date;
  260.     }
  261.     public function setDate(?\DateTimeInterface $date): self
  262.     {
  263.         $this->date $date;
  264.         return $this;
  265.     }
  266.     public function getCreatedBy(): ?Users
  267.     {
  268.         return $this->createdBy;
  269.     }
  270.     public function setCreatedBy(?Users $createdBy): self
  271.     {
  272.         $this->createdBy $createdBy;
  273.         return $this;
  274.     }
  275.     public function getUpdatedBy(): ?Users
  276.     {
  277.         return $this->updatedBy;
  278.     }
  279.     public function setUpdatedBy(?Users $updatedBy): self
  280.     {
  281.         $this->updatedBy $updatedBy;
  282.         return $this;
  283.     }
  284.     public function getIsEnabled(): ?bool
  285.     {
  286.         return $this->isEnabled;
  287.     }
  288.     public function setIsEnabled(?bool $isEnabled): self
  289.     {
  290.         $this->isEnabled $isEnabled;
  291.         return $this;
  292.     }
  293.     public function getLogo(): ?Picture
  294.     {
  295.         return $this->logo;
  296.     }
  297.     public function setLogo(?Picture $logo): self
  298.     {
  299.         if($logo->getTarget()){
  300.             $this->logo $logo;
  301.             $this->logo->setDir('upload/images/structures');
  302.             $this->logo->setThumbnailDir('upload/thumbnails/structures');
  303.         }
  304.         return $this;
  305.     }
  306.     public function getCategory(): ?StructuresCategories
  307.     {
  308.         return $this->category;
  309.     }
  310.     public function setCategory(?StructuresCategories $category): self
  311.     {
  312.         $this->category $category;
  313.         return $this;
  314.     }
  315.     public function getContent(): ?string
  316.     {
  317.         return $this->content;
  318.     }
  319.     public function setContent(?string $content): self
  320.     {
  321.         $this->content $content;
  322.         return $this;
  323.     }
  324.     public function getSlug(): ?string
  325.     {
  326.         return $this->slug;
  327.     }
  328.     public function setSlug(?string $slug): self
  329.     {
  330.         $this->slug $slug;
  331.         return $this;
  332.     }
  333.     public function getSector(): ?Sectors
  334.     {
  335.         return $this->sector;
  336.     }
  337.     public function setSector(?Sectors $sector): self
  338.     {
  339.         $this->sector $sector;
  340.         return $this;
  341.     }
  342.     /**
  343.      * @return Collection|Projects[]
  344.      */
  345.     public function getProjects(): Collection
  346.     {
  347.         return $this->projects;
  348.     }
  349.     public function addProject(Projects $project): self
  350.     {
  351.         if (!$this->projects->contains($project)) {
  352.             $this->projects[] = $project;
  353.             $project->setStructure($this);
  354.         }
  355.         return $this;
  356.     }
  357.     public function removeProject(Projects $project): self
  358.     {
  359.         if ($this->projects->removeElement($project)) {
  360.             // set the owning side to null (unless already changed)
  361.             if ($project->getStructure() === $this) {
  362.                 $project->setStructure(null);
  363.             }
  364.         }
  365.         return $this;
  366.     }
  367. }