src/Entity/Refill.php line 19
<?php
namespace App\Entity;
use App\Repository\RefillRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Action\NotFoundAction;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\ApiResource;
use Symfony\Component\Serializer\Annotation\MaxDepth;
#[ApiResource(
normalizationContext: ['enable_max_depth'=>true],
)]
#[ORM\Entity(repositoryClass: RefillRepository::class)]
class Refill
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[MaxDepth(1)]
#[ORM\ManyToOne(inversedBy: 'refills')]
private ?User $user = null;
#[MaxDepth(1)]
#[ORM\ManyToOne(inversedBy: 'refills')]
private ?Channel $channel = null;
#[MaxDepth(1)]
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?EntityName $entity = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?Action $action = null;
#[ORM\Column]
private ?int $quantity = null;
#[ORM\Column]
private ?int $used = null;
#[ORM\Column]
private ?int $createdDate = null;
#[ORM\Column(nullable: true)]
private ?int $expireDate = null;
#[ORM\OneToOne(mappedBy: 'refill', cascade: ['persist', 'remove'])]
private ?RefillAmend $refillAmend = null;
public function __construct()
{
$this->used = 0;
}
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getChannel(): ?Channel
{
return $this->channel;
}
public function setChannel(?Channel $channel): self
{
$this->channel = $channel;
return $this;
}
public function getEntity(): ?EntityName
{
return $this->entity;
}
public function setEntity(?EntityName $entity): self
{
$this->entity = $entity;
return $this;
}
public function getAction(): ?Action
{
return $this->action;
}
public function setAction(?Action $action): self
{
$this->action = $action;
return $this;
}
public function getQuantity(): ?int
{
return $this->quantity;
}
public function setQuantity(int $quantity): self
{
$this->quantity = $quantity;
return $this;
}
public function getUsed(): ?int
{
return $this->used;
}
public function setUsed(int $used): self
{
$this->used = $used;
return $this;
}
public function getCreatedDate(): ?int
{
return $this->createdDate;
}
public function setCreatedDate(int $createdDate): self
{
$this->createdDate = $createdDate;
return $this;
}
public function getExpireDate(): ?int
{
return $this->expireDate;
}
public function setExpireDate(?int $expireDate): self
{
$this->expireDate = $expireDate;
return $this;
}
public function getRefillAmend(): ?RefillAmend
{
return $this->refillAmend;
}
public function setRefillAmend(RefillAmend $refillAmend): self
{
// set the owning side of the relation if necessary
if ($refillAmend->getRefill() !== $this) {
$refillAmend->setRefill($this);
}
$this->refillAmend = $refillAmend;
return $this;
}
public function __toString()
{
return "Refill {$this->id} - Channel {$this->channel}";
}
}