src/Entity/AccountBlock.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AccountBlockRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassAccountBlockRepository::class)]
  9. class AccountBlock
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\ManyToOne(inversedBy'accountBlocks')]
  16.     #[ORM\JoinColumn(nullablefalse)]
  17.     private ?Account $account null;
  18.     #[ORM\ManyToOne(inversedBy'accountBlocks')]
  19.     #[ORM\JoinColumn(nullablefalse)]
  20.     private ?Block $block null;
  21.     #[ORM\ManyToMany(targetEntityQuestion::class)]
  22.     private Collection $activeQuestions;
  23.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  24.     private array $usedQuestions = [];
  25.     public function __construct()
  26.     {
  27.         $this->activeQuestions = new ArrayCollection();
  28.     }
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function getAccount(): ?Account
  34.     {
  35.         return $this->account;
  36.     }
  37.     public function setAccount(?Account $account): self
  38.     {
  39.         $this->account $account;
  40.         return $this;
  41.     }
  42.     public function getBlock(): ?Block
  43.     {
  44.         return $this->block;
  45.     }
  46.     public function setBlock(?Block $block): self
  47.     {
  48.         $this->block $block;
  49.         return $this;
  50.     }
  51.     /**
  52.      * @return Collection<int, Question>
  53.      */
  54.     public function getActiveQuestions(): ?Collection
  55.     {
  56.         return $this->activeQuestions;
  57.     }
  58.     public function addActiveQuestion(Question $activeQuestion): self
  59.     {
  60.         if (!$this->activeQuestions->contains($activeQuestion)) {
  61.             $this->activeQuestions->add($activeQuestion);
  62.         }
  63.         return $this;
  64.     }
  65.     public function removeActiveQuestion(Question $activeQuestion): self
  66.     {
  67.         $this->activeQuestions->removeElement($activeQuestion);
  68.         return $this;
  69.     }
  70.     public function getUsedQuestions(): array
  71.     {
  72.         return $this->usedQuestions;
  73.     }
  74.     public function setUsedQuestions(?array $usedQuestions): self
  75.     {
  76.         $this->usedQuestions $usedQuestions;
  77.         return $this;
  78.     }
  79. }