src/Entity/Warehouse.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\WarehouseRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=WarehouseRepository::class)
  9.  * @ORM\Table(name="warehouse")
  10.  */
  11. class Warehouse
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=120, unique=true)
  21.      */
  22.     private $name;
  23.     /**
  24.      * @ORM\Column(type="string", length=30, unique=true)
  25.      */
  26.     private $code;
  27.     /**
  28.      * @ORM\Column(type="string", length=30, nullable=true)
  29.      */
  30.     private $type;
  31.     /**
  32.      * @ORM\Column(type="text", nullable=true)
  33.      */
  34.     private $address;
  35.     /**
  36.      * @ORM\Column(type="string", length=120, nullable=true)
  37.      */
  38.     private $city;
  39.     /**
  40.      * @ORM\Column(name="is_active", type="boolean", options={"default":true})
  41.      */
  42.     private $isActive true;
  43.     /**
  44.      * @ORM\Column(name="is_default", type="boolean", options={"default":false})
  45.      */
  46.     private $isDefault false;
  47.     /**
  48.      * @ORM\Column(name="created_at", type="datetime")
  49.      */
  50.     private $createdAt;
  51.     /**
  52.      * @ORM\Column(name="updated_at", type="datetime", nullable=true)
  53.      */
  54.     private $updatedAt;
  55.     /**
  56.      * @ORM\OneToMany(targetEntity=Stock::class, mappedBy="warehouse")
  57.      */
  58.     private $stocks;
  59.     /**
  60.      * @ORM\OneToMany(targetEntity=StockMovement::class, mappedBy="warehouse")
  61.      */
  62.     private $stockMovements;
  63.     /**
  64.      * @ORM\OneToMany(targetEntity=StockTransfer::class, mappedBy="sourceWarehouse")
  65.      */
  66.     private $sourceTransfers;
  67.     /**
  68.      * @ORM\OneToMany(targetEntity=StockTransfer::class, mappedBy="targetWarehouse")
  69.      */
  70.     private $targetTransfers;
  71.     /**
  72.      * @ORM\ManyToMany(targetEntity=User::class, mappedBy="warehouses")
  73.      */
  74.     private $users;
  75.     public function __construct()
  76.     {
  77.         $this->stocks = new ArrayCollection();
  78.         $this->stockMovements = new ArrayCollection();
  79.         $this->sourceTransfers = new ArrayCollection();
  80.         $this->targetTransfers = new ArrayCollection();
  81.         $this->users = new ArrayCollection();
  82.         $this->createdAt = new \DateTime();
  83.         $this->updatedAt = new \DateTime();
  84.     }
  85.     public function getId(): ?int
  86.     {
  87.         return $this->id;
  88.     }
  89.     public function getName(): ?string
  90.     {
  91.         return $this->name;
  92.     }
  93.     public function setName(string $name): self
  94.     {
  95.         $this->name trim($name);
  96.         return $this;
  97.     }
  98.     public function getCode(): ?string
  99.     {
  100.         return $this->code;
  101.     }
  102.     public function setCode(string $code): self
  103.     {
  104.         $this->code strtoupper(trim($code));
  105.         return $this;
  106.     }
  107.     public function getType(): ?string
  108.     {
  109.         return $this->type;
  110.     }
  111.     public function setType(?string $type): self
  112.     {
  113.         $this->type $type !== null trim($type) : null;
  114.         return $this;
  115.     }
  116.     public function getAddress(): ?string
  117.     {
  118.         return $this->address;
  119.     }
  120.     public function setAddress(?string $address): self
  121.     {
  122.         $this->address $address !== null trim($address) : null;
  123.         return $this;
  124.     }
  125.     public function getCity(): ?string
  126.     {
  127.         return $this->city;
  128.     }
  129.     public function setCity(?string $city): self
  130.     {
  131.         $this->city $city !== null trim($city) : null;
  132.         return $this;
  133.     }
  134.     public function getIsActive(): bool
  135.     {
  136.         return (bool) $this->isActive;
  137.     }
  138.     public function setIsActive(bool $isActive): self
  139.     {
  140.         $this->isActive $isActive;
  141.         return $this;
  142.     }
  143.     public function getIsDefault(): bool
  144.     {
  145.         return (bool) $this->isDefault;
  146.     }
  147.     public function setIsDefault(bool $isDefault): self
  148.     {
  149.         $this->isDefault $isDefault;
  150.         return $this;
  151.     }
  152.     public function getCreatedAt(): ?\DateTimeInterface
  153.     {
  154.         return $this->createdAt;
  155.     }
  156.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  157.     {
  158.         $this->createdAt $createdAt;
  159.         return $this;
  160.     }
  161.     public function getUpdatedAt(): ?\DateTimeInterface
  162.     {
  163.         return $this->updatedAt;
  164.     }
  165.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  166.     {
  167.         $this->updatedAt $updatedAt;
  168.         return $this;
  169.     }
  170.     /**
  171.      * @return Collection|Stock[]
  172.      */
  173.     public function getStocks(): Collection
  174.     {
  175.         return $this->stocks;
  176.     }
  177.     /**
  178.      * @return Collection|StockMovement[]
  179.      */
  180.     public function getStockMovements(): Collection
  181.     {
  182.         return $this->stockMovements;
  183.     }
  184.     public function __toString(): string
  185.     {
  186.         return (string) $this->name;
  187.     }
  188.     /**
  189.      * @return Collection|User[]
  190.      */
  191.     public function getUsers(): Collection
  192.     {
  193.         return $this->users;
  194.     }
  195. }