<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\ProductBalanceInStorageRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
#[ORM\Entity(repositoryClass: ProductBalanceInStorageRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['product_storage_balance:read']],
denormalizationContext: ['groups' => ['product_storage_balance:write']],
order: ['manager' => 'DESC'],
)]
#[ApiFilter(
SearchFilter::class,
properties: [
'storage.id' => 'exact',
'product.id' => 'exact',
'manager.id' => 'exact',
],
)]
class ProductBalanceInStorage
{
#[Groups(['product_storage_balance:read', 'product_storage_balance:write', 'product:read', 'order_product:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[Groups(['product_storage_balance:read', 'product_storage_balance:write', 'product:read', 'order_product:read'])]
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date_entered = null;
#[Groups(['product_storage_balance:read', 'product_storage_balance:write', 'product:read', 'order_product:read'])]
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date_modified = null;
#[Groups(['product_storage_balance:read', 'product_storage_balance:write', 'product:read', 'order_product:read'])]
#[ORM\ManyToOne(inversedBy: 'productBalanceInStorages')]
#[ORM\JoinColumn(nullable: false)]
private ?Products $product = null;
#[Groups(['product_storage_balance:read', 'product_storage_balance:write', 'product:read', 'order_product:read'])]
#[ORM\ManyToOne(inversedBy: 'productBalanceInStorages')]
#[ORM\JoinColumn(nullable: false)]
private ?Storage $storage = null;
#[Groups(['product_storage_balance:read', 'product_storage_balance:write', 'product:read', 'order_product:read'])]
#[ORM\Column(nullable: true)]
private ?float $count = null;
#[Groups(['product_storage_balance:read', 'product_storage_balance:write', 'product:read', 'order_product:read'])]
#[ORM\ManyToOne(inversedBy: 'productBalanceInStorages')]
private ?User $manager = null;
#[Groups(['product_storage_balance:read', 'product_storage_balance:write', 'product:read', 'order_product:read'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $code1c = null;
public function getId(): ?int
{
return $this->id;
}
public function getDateEntered(): ?\DateTimeInterface
{
return $this->date_entered;
}
public function setDateEntered(?\DateTimeInterface $date_entered): self
{
$this->date_entered = $date_entered;
return $this;
}
public function getDateModified(): ?\DateTimeInterface
{
return $this->date_modified;
}
public function setDateModified(?\DateTimeInterface $date_modified): self
{
$this->date_modified = $date_modified;
return $this;
}
public function getProduct(): ?Products
{
return $this->product;
}
public function setProduct(?Products $product): self
{
$this->product = $product;
return $this;
}
public function getStorage(): ?Storage
{
return $this->storage;
}
public function setStorage(?Storage $storage): self
{
$this->storage = $storage;
return $this;
}
public function getCount(): ?float
{
return $this->count;
}
public function setCount(?float $count): self
{
$this->count = $count;
return $this;
}
public function getManager(): ?User
{
return $this->manager;
}
public function setManager(?User $manager): self
{
$this->manager = $manager;
return $this;
}
public function getCode1c(): ?string
{
return $this->code1c;
}
public function setCode1c(?string $code1c): self
{
$this->code1c = $code1c;
return $this;
}
}