src/Flexy/ShopBundle/Entity/Accounting/JournalEntry.php line 14
<?php
namespace App\Flexy\ShopBundle\Entity\Accounting;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\Flexy\ShopBundle\Entity\Accounting\JournalEntryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: JournalEntryRepository::class)]
#[ApiResource]
class JournalEntry
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $createdAt = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\OneToMany(mappedBy: 'journalEntry', targetEntity: JournalEntryItem::class, orphanRemoval: true)]
private Collection $journalEntryItems;
public function __construct()
{
$this->journalEntryItems = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, JournalEntryItem>
*/
public function getJournalEntryItems(): Collection
{
return $this->journalEntryItems;
}
public function addJournalEntryItem(JournalEntryItem $journalEntryItem): self
{
if (!$this->journalEntryItems->contains($journalEntryItem)) {
$this->journalEntryItems->add($journalEntryItem);
$journalEntryItem->setJournalEntry($this);
}
return $this;
}
public function removeJournalEntryItem(JournalEntryItem $journalEntryItem): self
{
if ($this->journalEntryItems->removeElement($journalEntryItem)) {
// set the owning side to null (unless already changed)
if ($journalEntryItem->getJournalEntry() === $this) {
$journalEntryItem->setJournalEntry(null);
}
}
return $this;
}
}