src/Entity/BPModel.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BPModelRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Dompdf\FrameReflower\Page;
  8. use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
  9. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  10. use Gedmo\Mapping\Annotation as Gedmo;
  11. /**
  12.  * @ORM\Entity(repositoryClass=BPModelRepository::class)
  13.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  14.  * @UniqueEntity(
  15.  *     fields={"name"},
  16.  *     errorPath="name",
  17.  *     message="Un business plan existe avec le même nom"
  18.  * )
  19.  */
  20. class BPModel extends BaseEntity
  21. {
  22.     use SoftDeleteableEntity;
  23.     /**
  24.      * @ORM\Id
  25.      * @ORM\GeneratedValue
  26.      * @ORM\Column(type="integer")
  27.      */
  28.     private $id;
  29.     /**
  30.      * @ORM\Column(type="string", length=191, unique=true)
  31.      */
  32.     private $name;
  33.     /**
  34.      * @ORM\Column(type="integer")
  35.      */
  36.     private $variableNumber;
  37.     /**
  38.      * @ORM\OneToOne(targetEntity=Variable::class, cascade={"persist", "remove"})
  39.      */
  40.     private $variable;
  41.     /**
  42.      * @ORM\OneToOne(targetEntity=FileManager::class, cascade={"persist", "remove"})
  43.      */
  44.     private $modelFile;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity=BPModelRole::class, mappedBy="bpModel")
  47.      */
  48.     private $bPModelRoles;
  49.     /**
  50.      * @ORM\OneToMany(targetEntity=Variable::class, mappedBy="bPModel", cascade={"persist", "remove"})
  51.      */
  52.     private $variables;
  53.     /**
  54.      * @ORM\OneToMany(targetEntity=CustomerBP::class, mappedBy="bpModel", cascade={"persist", "remove"})
  55.      */
  56.     private $customerBPs;
  57.     /**
  58.      * @Gedmo\Slug(fields={"name"})
  59.      * @ORM\Column(length=191)
  60.      */
  61.     private $slug;
  62.     /**
  63.      * @ORM\OneToOne(targetEntity=ImageManager::class, cascade={"persist", "remove"})
  64.      */
  65.     private $thumbnail;
  66.     /**
  67.      * @ORM\Column(type="text", nullable=true)
  68.      */
  69.     private $description;
  70.     /**
  71.      * @ORM\Column(type="string", length=255, nullable=true)
  72.      */
  73.     private $reference;
  74.     /**
  75.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  76.      */
  77.     private $price;
  78.     /**
  79.      * @ORM\Column(type="integer", nullable=true)
  80.      */
  81.     private $numberOfPage;
  82.     /**
  83.      * @ORM\OneToMany(targetEntity=PayPage::class, mappedBy="bpModel", cascade={"persist", "remove"})
  84.      */
  85.     private $payPages;
  86.     /**
  87.      * @ORM\ManyToOne(targetEntity=BpCategory::class, inversedBy="BpModel")
  88.      */
  89.     private $bpCategory;
  90.     /**
  91.      * @ORM\ManyToMany(targetEntity=User::class, inversedBy="bpModels")
  92.      */
  93.     private $customers;
  94.     public function __construct()
  95.     {
  96.         $this->bPModelRoles = new ArrayCollection();
  97.         $this->variables = new ArrayCollection();
  98.         $this->customerBPs = new ArrayCollection();
  99.         $this->payPages = new ArrayCollection();
  100.         $this->customers = new ArrayCollection();
  101.     }
  102.     public function getId(): ?int
  103.     {
  104.         return $this->id;
  105.     }
  106.     public function getName(): ?string
  107.     {
  108.         return $this->name;
  109.     }
  110.     public function setName(string $name): self
  111.     {
  112.         $this->name $name;
  113.         return $this;
  114.     }
  115.     public function getVariableNumber(): ?int
  116.     {
  117.         return $this->variableNumber;
  118.     }
  119.     public function setVariableNumber(int $variableNumber): self
  120.     {
  121.         $this->variableNumber $variableNumber;
  122.         return $this;
  123.     }
  124.     public function getVariable(): ?Variable
  125.     {
  126.         return $this->variable;
  127.     }
  128.     public function setVariable(?Variable $variable): self
  129.     {
  130.         $this->variable $variable;
  131.         return $this;
  132.     }
  133.     public function getModelFile(): ?FileManager
  134.     {
  135.         return $this->modelFile;
  136.     }
  137.     public function setModelFile(?FileManager $modelFile): self
  138.     {
  139.         $this->modelFile $modelFile;
  140.         return $this;
  141.     }
  142.     /**
  143.      * @return Collection<int, BPModelRole>
  144.      */
  145.     public function getBPModelRoles(): Collection
  146.     {
  147.         return $this->bPModelRoles;
  148.     }
  149.     public function addBPModelRole(BPModelRole $bPModelRole): self
  150.     {
  151.         if (!$this->bPModelRoles->contains($bPModelRole)) {
  152.             $this->bPModelRoles[] = $bPModelRole;
  153.             $bPModelRole->setBpModel($this);
  154.         }
  155.         return $this;
  156.     }
  157.     public function removeBPModelRole(BPModelRole $bPModelRole): self
  158.     {
  159.         if ($this->bPModelRoles->removeElement($bPModelRole)) {
  160.             // set the owning side to null (unless already changed)
  161.             if ($bPModelRole->getBpModel() === $this) {
  162.                 $bPModelRole->setBpModel(null);
  163.             }
  164.         }
  165.         return $this;
  166.     }
  167.     /**
  168.      * @return Collection<int, Variable>
  169.      */
  170.     public function getVariables(): Collection
  171.     {
  172.         return $this->variables;
  173.     }
  174.     public function addVariable(Variable $variable): self
  175.     {
  176.         if (!$this->variables->contains($variable)) {
  177.             $this->variables[] = $variable;
  178.             $variable->setBPModel($this);
  179.         }
  180.         return $this;
  181.     }
  182.     public function removeVariable(Variable $variable): self
  183.     {
  184.         if ($this->variables->removeElement($variable)) {
  185.             // set the owning side to null (unless already changed)
  186.             if ($variable->getBPModel() === $this) {
  187.                 $variable->setBPModel(null);
  188.             }
  189.         }
  190.         return $this;
  191.     }
  192.     /**
  193.      * @return Collection<int, CustomerBP>
  194.      */
  195.     public function getCustomerBPs(): Collection
  196.     {
  197.         return $this->customerBPs;
  198.     }
  199.     public function addCustomerBP(CustomerBP $customerBP): self
  200.     {
  201.         if (!$this->customerBPs->contains($customerBP)) {
  202.             $this->customerBPs[] = $customerBP;
  203.             $customerBP->setBpModel($this);
  204.         }
  205.         return $this;
  206.     }
  207.     public function removeCustomerBP(CustomerBP $customerBP): self
  208.     {
  209.         if ($this->customerBPs->removeElement($customerBP)) {
  210.             // set the owning side to null (unless already changed)
  211.             if ($customerBP->getBpModel() === $this) {
  212.                 $customerBP->setBpModel(null);
  213.             }
  214.         }
  215.         return $this;
  216.     }
  217.     public function getSlug(): ?string
  218.     {
  219.         return $this->slug;
  220.     }
  221.     public function setSlug(?string $slug): self
  222.     {
  223.         $this->slug $slug;
  224.         return $this;
  225.     }
  226.     public function getThumbnail(): ?ImageManager
  227.     {
  228.         return $this->thumbnail;
  229.     }
  230.     public function setThumbnail(?ImageManager $thumbnail): self
  231.     {
  232.         $this->thumbnail $thumbnail;
  233.         return $this;
  234.     }
  235.     public function getDescription(): ?string
  236.     {
  237.         return $this->description;
  238.     }
  239.     public function setDescription(?string $description): self
  240.     {
  241.         $this->description $description;
  242.         return $this;
  243.     }
  244.     public function getReference(): ?string
  245.     {
  246.         return $this->reference;
  247.     }
  248.     public function setReference(?string $reference): self
  249.     {
  250.         $this->reference $reference;
  251.         return $this;
  252.     }
  253.     public function getPrice(): ?string
  254.     {
  255.         return $this->price;
  256.     }
  257.     public function setPrice(?string $price): self
  258.     {
  259.         $this->price $price;
  260.         return $this;
  261.     }
  262.     public function getNumberOfPage(): ?int
  263.     {
  264.         return $this->numberOfPage;
  265.     }
  266.     public function setNumberOfPage(?int $numberOfPage): self
  267.     {
  268.         $this->numberOfPage $numberOfPage;
  269.         return $this;
  270.     }
  271.     /**
  272.      * @return Collection<int, PayPage>
  273.      */
  274.     public function getPayPages(): Collection
  275.     {
  276.         return $this->payPages;
  277.     }
  278.     public function addPayPage(PayPage $payPage): self
  279.     {
  280.         if (!$this->payPages->contains($payPage)) {
  281.             $this->payPages[] = $payPage;
  282.             $payPage->setBpModel($this);
  283.         }
  284.         return $this;
  285.     }
  286.     public function removePayPage(PayPage $payPage): self
  287.     {
  288.         if ($this->payPages->removeElement($payPage)) {
  289.             // set the owning side to null (unless already changed)
  290.             if ($payPage->getBpModel() === $this) {
  291.                 $payPage->setBpModel(null);
  292.             }
  293.         }
  294.         return $this;
  295.     }
  296.     public function getBpCategory(): ?BpCategory
  297.     {
  298.         return $this->bpCategory;
  299.     }
  300.     public function setBpCategory(?BpCategory $bpCategory): self
  301.     {
  302.         $this->bpCategory $bpCategory;
  303.         return $this;
  304.     }
  305.     /**
  306.      * @return Collection<int, User>
  307.      */
  308.     public function getCustomers(): Collection
  309.     {
  310.         return $this->customers;
  311.     }
  312.     public function addCustomer(User $customer): self
  313.     {
  314.         if (!$this->customers->contains($customer)) {
  315.             $this->customers[] = $customer;
  316.         }
  317.         return $this;
  318.     }
  319.     public function removeCustomer(User $customer): self
  320.     {
  321.         $this->customers->removeElement($customer);
  322.         return $this;
  323.     }
  324. }