<?php
namespace App\Entity;
use App\Repository\MaterialRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=MaterialRepository::class)
*
* @ORM\Table(name="material",indexes={
* @ORM\Index(name="material_name", columns={"name"})
* })
*/
class Material
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank
*/
private $name;
/**
* 1: Filamento, 2: Resina, 3: Polvo
* @ORM\Column(type="smallint")
* @Assert\NotBlank
*/
private $type;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank
*/
private $brand_model;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $composition;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $color;
/**
* @ORM\Column(type="string", length=1000, nullable=true)
*/
private $images;
/**
* @ORM\Column(type="string", length=510, nullable=true)
* @Assert\Length(
* max = 510
* )
*/
private $description;
/**
* @ORM\Column(type="string", length=1000, nullable=true)
*/
private $technical_files;
/**
* @ORM\Column(type="string", length=1000, nullable=true)
*/
private $other_files;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $stock;
/**
* @ORM\Column(type="string", length=510, nullable=true)
* @Assert\Length(
* max = 510
* )
*/
private $indications;
/**
* @ORM\ManyToOne(targetEntity=Company::class, inversedBy="materials")
* @ORM\JoinColumn(onDelete="CASCADE")
* @ORM\JoinColumn(nullable=false)
*/
private $company;
/**
* @ORM\ManyToMany(targetEntity=Equipment::class, mappedBy="materials")
*/
private $equipment;
/**
* @ORM\ManyToMany(targetEntity=Equipment::class)
*/
private $equipment_available;
public function __construct()
{
$this->equipment = new ArrayCollection();
$this->equipment_available = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getType(): ?int
{
return $this->type;
}
public function setType(int $type): self
{
$this->type = $type;
return $this;
}
public function getBrandModel(): ?string
{
return $this->brand_model;
}
public function setBrandModel(string $brand_model): self
{
$this->brand_model = $brand_model;
return $this;
}
public function getComposition(): ?string
{
return $this->composition;
}
public function setComposition(?string $composition): self
{
$this->composition = $composition;
return $this;
}
public function getColor(): ?string
{
return $this->color;
}
public function setColor(?string $color): self
{
$this->color = $color;
return $this;
}
public function getImages(): ?string
{
return $this->images;
}
public function setImages(?string $images): self
{
$this->images = $images;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getTechnicalFiles(): ?string
{
return $this->technical_files;
}
public function setTechnicalFiles(?string $technical_files): self
{
$this->technical_files = $technical_files;
return $this;
}
public function getOtherFiles(): ?string
{
return $this->other_files;
}
public function setOtherFiles(?string $other_files): self
{
$this->other_files = $other_files;
return $this;
}
public function getStock(): ?bool
{
return $this->stock;
}
public function setStock(bool $stock): self
{
$this->stock = $stock;
return $this;
}
public function getIndications(): ?string
{
return $this->indications;
}
public function setIndications(?string $indications): self
{
$this->indications = $indications;
return $this;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): self
{
$this->company = $company;
return $this;
}
/**
* @return Collection<int, Equipment>
*/
public function getEquipment(): Collection
{
return $this->equipment;
}
public function addEquipment(Equipment $equipment): self
{
if (!$this->equipment->contains($equipment)) {
$this->equipment[] = $equipment;
$equipment->addMaterial($this);
}
return $this;
}
public function removeEquipment(Equipment $equipment): self
{
if ($this->equipment->removeElement($equipment)) {
$equipment->removeMaterial($this);
}
return $this;
}
/**
* @return Collection<int, Equipment>
*/
public function getEquipmentAvailable(): Collection
{
return $this->equipment_available;
}
public function addEquipmentAvailable(Equipment $equipmentAvailable): self
{
if (!$this->equipment_available->contains($equipmentAvailable)) {
$this->equipment_available[] = $equipmentAvailable;
}
return $this;
}
public function removeEquipmentAvailable(Equipment $equipmentAvailable): self
{
$this->equipment_available->removeElement($equipmentAvailable);
return $this;
}
}