<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\PricesRepository;
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: PricesRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['price:read']],
denormalizationContext: ['groups' => ['price:write']],
order: ['id' => 'DESC'],
)]
#[ApiFilter(
SearchFilter::class,
properties: [
'product' => 'exact',
'agreement.id' => 'exact',
'agreement.virtual' => 'exact',
'agreement.account.id' => 'exact',
],
)]
class Prices
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['price:read', 'price:write', 'agreements:read', 'product:read', 'order:read', 'load_invoice:read', 'pre_order:write'])]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'prices')]
#[Groups(['price:read', 'price:write'])]
private ?Products $product = null;
#[ORM\ManyToOne(inversedBy: 'prices')]
#[Groups(['price:read', 'price:write','product:read'])]
private ?Agreements $agreement = null;
#[ORM\Column(nullable: true)]
#[Groups(['price:read', 'price:write', 'agreements:read', 'product:read', 'order:read', 'load_invoice:read', 'pre_order:write'])]
private ?float $price = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
#[Groups(['price:read', 'price:write', 'agreements:read', 'product:read', 'order:read', 'load_invoice:read', 'pre_order:write'])]
private ?string $description = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
#[Groups(['price:read', 'price:write', 'agreements:read', 'product:read', 'order:read', 'load_invoice:read', 'pre_order:write'])]
private ?\DateTimeInterface $date_entered = null;
#[Groups(['price:read', 'price:write', 'agreements:read', 'product:read', 'order:read', 'load_invoice:read', 'pre_order:write'])]
#[ORM\Column(nullable: true)]
private ?bool $active = null;
#[Groups(['price:read', 'price:write', 'agreements:read', 'product:read', 'order:read', 'load_invoice:read', 'pre_order:write'])]
#[ORM\Column(nullable: true)]
private ?float $sellPrice = null;
#[Groups(['price:read', 'price:write', 'agreements:read', 'product:read', 'order:read', 'load_invoice:read', 'pre_order:write'])]
#[ORM\Column(nullable: true)]
private ?float $markUp = null;
#[Groups(['price:read', 'price:write', 'agreements:read', 'product:read', 'order:read', 'load_invoice:read', 'pre_order:write'])]
#[ORM\Column(nullable: true)]
private ?float $priceSalesFact = null;
#[Groups(['price:read', 'price:write', 'agreements:read', 'product:read', 'order:read', 'load_invoice:read', 'pre_order:write'])]
#[ORM\Column(nullable: true)]
private ?float $purchasePrice = null;
#[Groups(['price:read', 'price:write', 'agreements:read', 'product:read', 'order:read', 'load_invoice:read', 'pre_order:write'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $code1c = null;
public function getId(): ?int
{
return $this->id;
}
public function getProduct(): ?Products
{
return $this->product;
}
public function setProduct(?Products $product): static
{
$this->product = $product;
return $this;
}
public function getAgreement(): ?Agreements
{
return $this->agreement;
}
public function setAgreement(?Agreements $agreement): static
{
$this->agreement = $agreement;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(?float $price): static
{
$this->price = $price;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
public function getDateEntered(): ?\DateTimeInterface
{
return $this->date_entered;
}
public function setDateEntered(?\DateTimeInterface $date_entered): static
{
$this->date_entered = $date_entered;
return $this;
}
public function isActive(): ?bool
{
return $this->active;
}
public function setActive(?bool $active): static
{
$this->active = $active;
return $this;
}
public function getSellPrice(): ?float
{
return $this->sellPrice;
}
public function setSellPrice(?float $sellPrice): static
{
$this->sellPrice = $sellPrice;
return $this;
}
public function getMarkUp(): ?float
{
return $this->markUp;
}
public function setMarkUp(?float $markUp): static
{
$this->markUp = $markUp;
return $this;
}
public function getPriceSalesFact(): ?float
{
return $this->priceSalesFact;
}
public function setPriceSalesFact(?float $priceSalesFact): static
{
$this->priceSalesFact = $priceSalesFact;
return $this;
}
public function getPurchasePrice(): ?float
{
return $this->purchasePrice;
}
public function setPurchasePrice(?float $purchasePrice): static
{
$this->purchasePrice = $purchasePrice;
return $this;
}
public function getCode1c(): ?string
{
return $this->code1c;
}
public function setCode1c(?string $code1c): static
{
$this->code1c = $code1c;
return $this;
}
}