src/Entity/CustomerSentNotification.php line 19
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert,
Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use App\Entity\Trait\IdTrait,
App\Entity\Trait\UuidTrait,
App\Entity\Trait\StatTrait,
App\Entity\Trait\TimestampableTrait,
App\Repository\CustomerSentNotificationRepository,
App\Entity\Interface\StatableInterface;
#[UniqueEntity(fields: ['parent', 'issue'], errorPath: 'issue', ignoreNull: false, message: 'This value already exists.')]
#[ORM\UniqueConstraint(fields: ['parent', 'issue'])]
#[ORM\Entity(repositoryClass: CustomerSentNotificationRepository::class)]
class CustomerSentNotification implements StatableInterface
{
use IdTrait,
UuidTrait,
StatTrait,
TimestampableTrait;
#[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: Customer::class, inversedBy: 'sentNotifications')]
#[ORM\JoinColumn(onDelete: 'cascade', nullable: false)]
private Customer $parent;
#[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: JournalIssue::class)]
#[ORM\JoinColumn(onDelete: 'cascade', nullable: false)]
private JournalIssue $issue;
public function __construct(Customer $parent, JournalIssue $issue)
{
$this->setUuid();
$this->parent = $parent;
$this->issue = $issue;
$this->createdAt = new \DateTimeImmutable();
$this->updatedAt = new \DateTimeImmutable();
$parent->addSentNotification($this);
}
public function getParent(): Customer
{
return $this->parent;
}
public function getIssue(): JournalIssue
{
return $this->issue;
}
}