src/Entity/Jurisprudence.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\JurisprudenceRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use Vich\UploaderBundle\Entity\File;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. /**
  11.  * @ORM\Entity(repositoryClass=JurisprudenceRepository::class)
  12.  * @Vich\Uploadable
  13.  */
  14. class Jurisprudence
  15. {
  16.     const QUALITY_NONE null;
  17.     const QUALITY_GOOD 'good';
  18.     const QUALITY_BAD 'bad';
  19.     /**
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue
  22.      * @ORM\Column(type="integer")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\Column(type="boolean")
  27.      */
  28.     private bool $active false;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity=User::class)
  31.      * @ORM\JoinColumn(nullable=true)
  32.      */
  33.     private ?User $author;
  34.     /**
  35.      * @Assert\NotBlank
  36.      * @ORM\Column(type="string", length=255)
  37.      */
  38.     private string $name;
  39.     /**
  40.      * @Assert\NotBlank
  41.      * @ORM\Column(type="text")
  42.      */
  43.     private string $content;
  44.     /**
  45.      * @ORM\Column(type="text", length=255)
  46.      */
  47.     private string $chapo;
  48.     /**
  49.      * @ORM\Column(type="datetime", nullable=true)
  50.      */
  51.     private ?\Datetime $createdAt;
  52.     /**
  53.      * @ORM\Column(type="datetime", nullable=true)
  54.      */
  55.     private ?\Datetime $updatedAt;
  56.     /**
  57.      * @Assert\NotNull
  58.      * @ORM\ManyToMany(targetEntity="App\Entity\JurisprudenceCategory", inversedBy="jps", cascade={"persist"})
  59.      * @ORM\JoinTable(name="jp_categories")
  60.      * @ORM\OrderBy({"name" = "ASC"})
  61.      */
  62.     private $category;
  63.     /**
  64.      * @ORM\Column(type="datetime", nullable=true)
  65.      */
  66.     private \DateTime $date;
  67.     /**
  68.      * @ORM\Column(type="string", length=255, nullable=true)
  69.      * @var string
  70.      */
  71.     private $pdf;
  72.     /**
  73.      * @Vich\UploadableField(mapping="juriprudences_pdf", fileNameProperty="pdf")
  74.      * @var File
  75.      */
  76.     private $pdfFile;
  77.     /**
  78.      * @ORM\Column(type="string", length=20, nullable=true)
  79.      * @var string
  80.      */
  81.     private $quality self::QUALITY_NONE;
  82.     /**
  83.      * @ORM\Column(type="string", length=255, nullable=true)
  84.      * @var string
  85.      */
  86.     private $justiceCourt;
  87.     /**
  88.      * @ORM\ManyToMany(targetEntity="App\Entity\Keywords", inversedBy="mentionsJp", cascade={"persist"})
  89.      * @ORM\JoinTable(name="jp_keywords")
  90.      * @ORM\OrderBy({"keyword" = "ASC"})
  91.      */
  92.     private $listekeywords;
  93.     /**
  94.      * @ORM\ManyToMany(targetEntity="App\Entity\Lexique", inversedBy="mentionsJp", cascade={"persist"})
  95.      * @ORM\JoinTable(name="jp_lexiques")
  96.      * @ORM\OrderBy({"word" = "ASC"})
  97.      */
  98.     private $listelexique;
  99.     /**
  100.      * @ORM\Column(type="string", length=255, nullable=true)
  101.      * 
  102.      */
  103.     private $rg;
  104.     /**
  105.      * @ORM\Column(type="boolean")
  106.      */
  107.     private bool $important false;
  108.     /**
  109.      * @ORM\Column(type="boolean")
  110.      */
  111.     private bool $pinned false;
  112.     
  113.     public function __construct()
  114.     {
  115.         $this->createdAt = new \DateTime();
  116.         $this->updatedAt = new \DateTime();
  117.         $this->date = new \DateTime();
  118.         $this->listekeywords = new ArrayCollection();
  119.         $this->listelexique = new ArrayCollection();
  120.         $this->category = new ArrayCollection();
  121.     }
  122.     public function getId(): ?int
  123.     {
  124.         return $this->id;
  125.     }
  126.     public function getName(): ?string
  127.     {
  128.         return $this->name;
  129.     }
  130.     public function setName(string $name): self
  131.     {
  132.         $this->name $name;
  133.         return $this;
  134.     }
  135.     public function getContent(): ?string
  136.     {
  137.         return $this->content;
  138.     }
  139.     public function setContent(string $content): self
  140.     {
  141.         $this->content $content;
  142.         return $this;
  143.     }
  144.     public function getCreatedAt(): ?\DateTimeInterface
  145.     {
  146.         return $this->createdAt;
  147.     }
  148.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  149.     {
  150.         $this->createdAt $createdAt;
  151.         return $this;
  152.     }
  153.     public function setCategory(Collection $category): self
  154.     {
  155.         $this->category $category;
  156.         return $this;
  157.     }
  158.     public function getDate(): ?\DateTimeInterface
  159.     {
  160.         return $this->date;
  161.     }
  162.     public function setDate(\DateTimeInterface $date): self
  163.     {
  164.         $this->date $date;
  165.         return $this;
  166.     }
  167.     public function isActive(): bool
  168.     {
  169.         return $this->active;
  170.     }
  171.     public function setActive(bool $active): void
  172.     {
  173.         $this->active $active;
  174.     }
  175.     public function getAuthor(): ?User
  176.     {
  177.         return $this->author;
  178.     }
  179.     public function setAuthor(?User $author): void
  180.     {
  181.         $this->author $author;
  182.     }
  183.     public function getUpdatedAt(): ?\DateTime
  184.     {
  185.         return $this->updatedAt;
  186.     }
  187.     public function setUpdatedAt(?\DateTime $updatedAt): void
  188.     {
  189.         $this->updatedAt $updatedAt;
  190.     }
  191.     public function setPdfFile($pdf null)
  192.     {
  193.         $this->pdfFile $pdf;
  194.         // VERY IMPORTANT:
  195.         // It is required that at least one field changes if you are using Doctrine,
  196.         // otherwise the event listeners won't be called and the file is lost
  197.         if ($pdf) {
  198.             // if 'updatedAt' is not defined in your entity, use another property
  199.             $this->updatedAt = new \DateTime('now');
  200.         }
  201.     }
  202.     public function getPdfFile()
  203.     {
  204.         return $this->pdfFile;
  205.     }
  206.     public function setPdf($pdf)
  207.     {
  208.         // $pdf = str_replace(' ', '_', $pdf);
  209.         $this->pdf $pdf;
  210.     }
  211.     public function getPdf()
  212.     {
  213.         return $this->pdf;
  214.     }
  215.     public function getQuality(): ?string
  216.     {
  217.         return $this->quality;
  218.     }
  219.     public function setQuality(?string $quality): void
  220.     {
  221.         $this->quality $quality;
  222.     }
  223.     public function getJusticeCourt(): ?string
  224.     {
  225.         return $this->justiceCourt;
  226.     }
  227.     public function setJusticeCourt(?string $justiceCourt): void
  228.     {
  229.         $this->justiceCourt $justiceCourt;
  230.     }
  231.     public function getListelexique(): Collection
  232.     {
  233.         return $this->listelexique;
  234.     }
  235.     public function addListelexique(Lexique $lexique): self
  236.     {
  237.         if (!$this->listelexique->contains($lexique)) {
  238.             $this->listelexique[] = $lexique;
  239.         }
  240.         return $this;
  241.     }
  242.     public function removeListelexique(Lexique $lexique): self
  243.     {
  244.         $this->listelexique->removeElement($lexique);
  245.         return $this;
  246.     }
  247.     /**
  248.      * @return Collection<int, Keywords>
  249.      */
  250.     public function getListekeywords(): Collection
  251.     {
  252.         return $this->listekeywords;
  253.     }
  254.     public function addListekeyword(Keywords $listekeyword): self
  255.     {
  256.         if (!$this->listekeywords->contains($listekeyword)) {
  257.             $this->listekeywords[] = $listekeyword;
  258.         }
  259.         return $this;
  260.     }
  261.     public function removeListekeyword(Keywords $listekeyword): self
  262.     {
  263.         $this->listekeywords->removeElement($listekeyword);
  264.         return $this;
  265.     }
  266.     public function getCategory(): Collection
  267.     {
  268.         return $this->category;
  269.     }
  270.     public function addCategory(JurisprudenceCategory $category): self
  271.     {
  272.         if (!$this->category->contains($category)) {
  273.             $this->category[] = $category;
  274.         }
  275.         return $this;
  276.     }
  277.     public function removeCategory(JurisprudenceCategory $category): self
  278.     {
  279.         $this->category->removeElement($category);
  280.         return $this;
  281.     }
  282.     public function getRg(): ?string
  283.     {
  284.         return $this->rg;
  285.     }
  286.     public function setRg(string $rg): self
  287.     {
  288.         $this->rg $rg;
  289.         return $this;
  290.     }
  291.     public function isImportant(): ?bool
  292.     {
  293.         return $this->important;
  294.     }
  295.     public function setImportant(bool $important): self
  296.     {
  297.         $this->important $important;
  298.         return $this;
  299.     }
  300.     public function getChapo(): ?string
  301.     {
  302.         return $this->chapo;
  303.     }
  304.     public function setChapo(string $chapo): self
  305.     {
  306.         $this->chapo $chapo;
  307.         return $this;
  308.     }
  309.     public function getPinned()
  310.     {
  311.         return $this->pinned;
  312.     }
  313.     public function setPinned($pinned)
  314.     {
  315.         $this->pinned $pinned;
  316.         return $this;
  317.     }
  318. }