src/Entity/Material.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MaterialRepository;
  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. /**
  9.  * @ORM\Entity(repositoryClass=MaterialRepository::class)
  10.  * 
  11.  * @ORM\Table(name="material",indexes={
  12.  *     @ORM\Index(name="material_name", columns={"name"})
  13.  * })
  14.  */
  15. class Material
  16. {
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      * @Assert\NotBlank
  26.      */
  27.     private $name;
  28.     /**
  29.      * 1: Filamento, 2: Resina, 3: Polvo
  30.      * @ORM\Column(type="smallint")
  31.      * @Assert\NotBlank
  32.      */
  33.     private $type;
  34.     /**
  35.      * @ORM\Column(type="string", length=255)
  36.      * @Assert\NotBlank
  37.      */
  38.     private $brand_model;
  39.     /**
  40.      * @ORM\Column(type="string", length=255, nullable=true)
  41.      */
  42.     private $composition;
  43.     /**
  44.      * @ORM\Column(type="string", length=255, nullable=true)
  45.      */
  46.     private $color;
  47.     /**
  48.      * @ORM\Column(type="string", length=1000, nullable=true)
  49.      */
  50.     private $images;
  51.     /**
  52.      * @ORM\Column(type="string", length=510, nullable=true)
  53.      * @Assert\Length(
  54.      *      max = 510
  55.      * )
  56.      */
  57.     private $description;
  58.     /**
  59.      * @ORM\Column(type="string", length=1000, nullable=true)
  60.      */
  61.     private $technical_files;
  62.     /**
  63.      * @ORM\Column(type="string", length=1000, nullable=true)
  64.      */
  65.     private $other_files;
  66.     /**
  67.      * @ORM\Column(type="boolean", nullable=true)
  68.      */
  69.     private $stock;
  70.     /**
  71.      * @ORM\Column(type="string", length=510, nullable=true)
  72.      * @Assert\Length(
  73.      *      max = 510
  74.      * )
  75.      */
  76.     private $indications;
  77.     /**
  78.      * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="materials")
  79.      * @ORM\JoinColumn(onDelete="CASCADE")
  80.      * @ORM\JoinColumn(nullable=false)
  81.      */
  82.     private $company;
  83.     /**
  84.      * @ORM\ManyToMany(targetEntity=Equipment::class, mappedBy="materials")
  85.      */
  86.     private $equipment;
  87.     /**
  88.      * @ORM\ManyToMany(targetEntity=Equipment::class)
  89.      */
  90.     private $equipment_available;
  91.     public function __construct()
  92.     {
  93.         $this->equipment = new ArrayCollection();
  94.         $this->equipment_available = new ArrayCollection();
  95.     }
  96.     public function getId(): ?int
  97.     {
  98.         return $this->id;
  99.     }
  100.     public function getName(): ?string
  101.     {
  102.         return $this->name;
  103.     }
  104.     public function setName(string $name): self
  105.     {
  106.         $this->name $name;
  107.         return $this;
  108.     }
  109.     public function getType(): ?int
  110.     {
  111.         return $this->type;
  112.     }
  113.     public function setType(int $type): self
  114.     {
  115.         $this->type $type;
  116.         return $this;
  117.     }
  118.     public function getBrandModel(): ?string
  119.     {
  120.         return $this->brand_model;
  121.     }
  122.     public function setBrandModel(string $brand_model): self
  123.     {
  124.         $this->brand_model $brand_model;
  125.         return $this;
  126.     }
  127.     public function getComposition(): ?string
  128.     {
  129.         return $this->composition;
  130.     }
  131.     public function setComposition(?string $composition): self
  132.     {
  133.         $this->composition $composition;
  134.         return $this;
  135.     }
  136.     public function getColor(): ?string
  137.     {
  138.         return $this->color;
  139.     }
  140.     public function setColor(?string $color): self
  141.     {
  142.         $this->color $color;
  143.         return $this;
  144.     }
  145.     public function getImages(): ?string
  146.     {
  147.         return $this->images;
  148.     }
  149.     public function setImages(?string $images): self
  150.     {
  151.         $this->images $images;
  152.         return $this;
  153.     }
  154.     public function getDescription(): ?string
  155.     {
  156.         return $this->description;
  157.     }
  158.     public function setDescription(?string $description): self
  159.     {
  160.         $this->description $description;
  161.         return $this;
  162.     }
  163.     public function getTechnicalFiles(): ?string
  164.     {
  165.         return $this->technical_files;
  166.     }
  167.     public function setTechnicalFiles(?string $technical_files): self
  168.     {
  169.         $this->technical_files $technical_files;
  170.         return $this;
  171.     }
  172.     public function getOtherFiles(): ?string
  173.     {
  174.         return $this->other_files;
  175.     }
  176.     public function setOtherFiles(?string $other_files): self
  177.     {
  178.         $this->other_files $other_files;
  179.         return $this;
  180.     }
  181.     public function getStock(): ?bool
  182.     {
  183.         return $this->stock;
  184.     }
  185.     public function setStock(bool $stock): self
  186.     {
  187.         $this->stock $stock;
  188.         return $this;
  189.     }
  190.     public function getIndications(): ?string
  191.     {
  192.         return $this->indications;
  193.     }
  194.     public function setIndications(?string $indications): self
  195.     {
  196.         $this->indications $indications;
  197.         return $this;
  198.     }
  199.     public function getCompany(): ?Company
  200.     {
  201.         return $this->company;
  202.     }
  203.     public function setCompany(?Company $company): self
  204.     {
  205.         $this->company $company;
  206.         return $this;
  207.     }
  208.     /**
  209.      * @return Collection<int, Equipment>
  210.      */
  211.     public function getEquipment(): Collection
  212.     {
  213.         return $this->equipment;
  214.     }
  215.     public function addEquipment(Equipment $equipment): self
  216.     {
  217.         if (!$this->equipment->contains($equipment)) {
  218.             $this->equipment[] = $equipment;
  219.             $equipment->addMaterial($this);
  220.         }
  221.         return $this;
  222.     }
  223.     public function removeEquipment(Equipment $equipment): self
  224.     {
  225.         if ($this->equipment->removeElement($equipment)) {
  226.             $equipment->removeMaterial($this);
  227.         }
  228.         return $this;
  229.     }
  230.     /**
  231.      * @return Collection<int, Equipment>
  232.      */
  233.     public function getEquipmentAvailable(): Collection
  234.     {
  235.         return $this->equipment_available;
  236.     }
  237.     public function addEquipmentAvailable(Equipment $equipmentAvailable): self
  238.     {
  239.         if (!$this->equipment_available->contains($equipmentAvailable)) {
  240.             $this->equipment_available[] = $equipmentAvailable;
  241.         }
  242.         return $this;
  243.     }
  244.     public function removeEquipmentAvailable(Equipment $equipmentAvailable): self
  245.     {
  246.         $this->equipment_available->removeElement($equipmentAvailable);
  247.         return $this;
  248.     }
  249. }