<?phpdeclare(strict_types=1);namespace App\Entity;use App\Entity\User as SuluUser;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Doctrine\ORM\Mapping\UniqueConstraint;use JMS\Serializer\Annotation as Serializer;use Symfony\Component\Security\Core\User\UserInterface;#[ORM\Entity]#[ORM\Table(name: 'jm_user_article')]#[UniqueConstraint(name: 'user_article_unique', columns: ['user_id', 'article_identifier'])]class UserArticle{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\ManyToOne(targetEntity: SuluUser::class, inversedBy: 'articles')] private UserInterface $user; #[ORM\Column(type: 'string', length: 192)] #[Serializer\Groups(['profile'])] private string $articleIdentifier = ''; #[ORM\OneToMany(targetEntity: UserArticlePayment::class, mappedBy: 'userArticle')] private Collection $payments; #[ORM\Column(type: 'boolean', options: ['default' => 0])] private bool $active = false; public function __construct() { $this->user = new SuluUser(); $this->payments = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getUser(): UserInterface { return $this->user; } public function setUser(UserInterface $user): self { $this->user = $user; return $this; } public function getArticleIdentifier(): string { return $this->articleIdentifier; } public function setArticleIdentifier(string $articleIdentifier): self { $this->articleIdentifier = $articleIdentifier; return $this; } public function isActive(): bool { return $this->active; } public function setActive(bool $active): self { $this->active = $active; return $this; } public function getPayments(): Collection { return $this->payments; } /** * @psalm-suppress RedundantConditionGivenDocblockType */ public function addPayment(UserArticlePayment $payment): self { if (!$this->payments->contains($payment)) { $this->payments[] = $payment; $payment->setUserArticle($this); } return $this; }}