src/Entity/Channel/PositioningTest/Attempt/Attempt.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Channel\PositioningTest\Attempt;
  3. use App\Entity\Channel\PositioningTest\PositioningTest;
  4. use App\Entity\ChannelUserData\ChannelUserData;
  5. use App\Entity\Common\Contact;
  6. use App\Enum\Channel\PositioningTest\StatusEnum;
  7. use App\Repository\Channel\PositioningTest\Attempt\AttemptRepository;
  8. use DateTime;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use DrosalysWeb\ObjectExtensions\Blame\Model\BlameInterface;
  13. use DrosalysWeb\ObjectExtensions\Blame\Model\BlameTrait;
  14. use DrosalysWeb\ObjectExtensions\Timestamp\Model\TimestampInterface;
  15. use DrosalysWeb\ObjectExtensions\Timestamp\Model\TimestampTrait;
  16. use Nellapp\Bundle\SDKBundle\Google\Entity\GoogleExportableInterface;
  17. use Nellapp\Bundle\SDKBundle\Google\Entity\GoogleExportedData\GoogleExportedData;
  18. #[
  19.     ORM\Entity(repositoryClassAttemptRepository::class),
  20.     ORM\Table(name'channel_positioning_test_attempts'),
  21. ]
  22. class Attempt implements TimestampInterfaceBlameInterfaceGoogleExportableInterface
  23. {
  24.     use TimestampTrait;
  25.     use BlameTrait;
  26.     #[ORM\Id]
  27.     #[ORM\GeneratedValue]
  28.     #[ORM\Column(type'integer')]
  29.     private ?int $id null;
  30.     #[ORM\Column(type'string'length64uniquetrue)]
  31.     private ?string $accessToken;
  32.     #[ORM\Column(type'datetime'nullabletrue)]
  33.     private ?DateTime $startedAt null;
  34.     #[ORM\Column(type'datetime'nullabletrue)]
  35.     private ?DateTime $endedAt null;
  36.     #[ORM\Column(type'integer')]
  37.     private ?int $time 0;
  38.     #[ORM\Column(type'string'nullabletrueoptions: ['default' => StatusEnum::WAITING])]
  39.     private ?string $status StatusEnum::WAITING;
  40.     #[ORM\Column(type'string'nullabletrueoptions: ['default' => null])]
  41.     private ?string $result null;
  42.     #[ORM\Column(type'boolean'nullablefalse)]
  43.     private bool $emailConfirmed false;
  44.     #[ORM\Column(type'boolean'nullabletrue)]
  45.     private ?bool $isInterestedInWorkStudy null;
  46.     #[ORM\Column(type'boolean'nullabletrue)]
  47.     private ?bool $isInterestedByFindWorkStudyTrainee null;
  48.     #[ORM\ManyToOne(targetEntityContact::class, cascade: ['persist'])]
  49.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  50.     private ?Contact $prospect null;
  51.     #[ORM\ManyToOne(targetEntityChannelUserData::class, cascade: ['persist'], inversedBy:  'positioningTestAttempts')]
  52.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  53.     private ?ChannelUserData $channelUserData null;
  54.     #[ORM\ManyToOne(targetEntityPositioningTest::class, inversedBy'attempts')]
  55.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  56.     private ?PositioningTest $positioningTest null;
  57.     #[ORM\OneToMany(mappedBy'attempt'targetEntityAttemptBlock::class, cascade: ['persist''remove'], orphanRemovaltrue)]
  58.     #[ORM\OrderBy(['rank' => 'ASC'])]
  59.     private ?Collection $attemptBlocks;
  60.     #[ORM\OneToOne(targetEntityGoogleExportedData::class, cascade: ['persist''remove'], orphanRemovaltrue)]
  61.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  62.     private ?GoogleExportedData $googleExportedData null;
  63.     public function __construct()
  64.     {
  65.         $this->accessToken bin2hex(random_bytes(32));
  66.         $this->attemptBlocks = new ArrayCollection();
  67.     }
  68.     public function getId(): ?int
  69.     {
  70.         return $this->id;
  71.     }
  72.     public function getAccessToken(): ?string
  73.     {
  74.         return $this->accessToken;
  75.     }
  76.     public function setAccessToken(?string $accessToken): static
  77.     {
  78.         $this->accessToken $accessToken;
  79.         return $this;
  80.     }
  81.     public function getStartedAt(): ?DateTime
  82.     {
  83.         return $this->startedAt;
  84.     }
  85.     public function setStartedAt(?DateTime $startedAt): static
  86.     {
  87.         $this->startedAt $startedAt;
  88.         return $this;
  89.     }
  90.     public function getEndedAt(): ?DateTime
  91.     {
  92.         return $this->endedAt;
  93.     }
  94.     public function setEndedAt(?DateTime $endedAt): static
  95.     {
  96.         $this->endedAt $endedAt;
  97.         return $this;
  98.     }
  99.     public function getTime(): ?int
  100.     {
  101.         return $this->time;
  102.     }
  103.     public function setTime(?int $time): static
  104.     {
  105.         $this->time $time;
  106.         return $this;
  107.     }
  108.     public function getStatus(): ?string
  109.     {
  110.         return $this->status;
  111.     }
  112.     public function setStatus(?string $status): static
  113.     {
  114.         $this->status $status;
  115.         return $this;
  116.     }
  117.     public function getResult(): ?string
  118.     {
  119.         return $this->result;
  120.     }
  121.     public function setResult(?string $result): static
  122.     {
  123.         $this->result $result;
  124.         return $this;
  125.     }
  126.     public function isEmailConfirmed(): bool
  127.     {
  128.         return $this->emailConfirmed;
  129.     }
  130.     public function setEmailConfirmed(bool $emailConfirmed): static
  131.     {
  132.         $this->emailConfirmed $emailConfirmed;
  133.         return $this;
  134.     }
  135.     public function getIsInterestedInWorkStudy(): ?bool
  136.     {
  137.         return $this->isInterestedInWorkStudy;
  138.     }
  139.     public function setIsInterestedInWorkStudy(?bool $isInterestedInWorkStudy): static
  140.     {
  141.         $this->isInterestedInWorkStudy $isInterestedInWorkStudy;
  142.         return $this;
  143.     }
  144.     public function getIsInterestedByFindWorkStudyTrainee(): ?bool
  145.     {
  146.         return $this->isInterestedByFindWorkStudyTrainee;
  147.     }
  148.     public function setIsInterestedByFindWorkStudyTrainee(?bool $isInterestedByFindWorkStudyTrainee): static
  149.     {
  150.         $this->isInterestedByFindWorkStudyTrainee $isInterestedByFindWorkStudyTrainee;
  151.         return $this;
  152.     }
  153.     public function getProspect(): ?Contact
  154.     {
  155.         return $this->prospect;
  156.     }
  157.     public function setProspect(?Contact $prospect): static
  158.     {
  159.         $this->prospect $prospect;
  160.         return $this;
  161.     }
  162.     public function getChannelUserData(): ?ChannelUserData
  163.     {
  164.         return $this->channelUserData;
  165.     }
  166.     public function setChannelUserData(?ChannelUserData $channelUserData): static
  167.     {
  168.         $this->channelUserData $channelUserData;
  169.         return $this;
  170.     }
  171.     public function getPositioningTest(): ?PositioningTest
  172.     {
  173.         return $this->positioningTest;
  174.     }
  175.     public function setPositioningTest(?PositioningTest $positioningTest): static
  176.     {
  177.         $this->positioningTest $positioningTest;
  178.         return $this;
  179.     }
  180.     /**
  181.      * @return Collection<int, AttemptBlock>|null
  182.      */
  183.     public function getAttemptBlocks(): ?Collection
  184.     {
  185.         return $this->attemptBlocks;
  186.     }
  187.     public function addAttemptBlock(AttemptBlock $attemptBlock): self
  188.     {
  189.         if (!$this->attemptBlocks->contains($attemptBlock)) {
  190.             $attemptBlock->setAttempt($this);
  191.             $this->attemptBlocks[] = $attemptBlock;
  192.         }
  193.         return $this;
  194.     }
  195.     public function removeAttemptBlock(AttemptBlock $attemptBlock): self
  196.     {
  197.         if ($this->attemptBlocks->contains($attemptBlock)) {
  198.             $this->attemptBlocks->removeElement($attemptBlock);
  199.         }
  200.         return $this;
  201.     }
  202.     public function getGoogleExportedData(): ?GoogleExportedData
  203.     {
  204.         return $this->googleExportedData;
  205.     }
  206.     public function setGoogleExportedData(?GoogleExportedData $googleExportedData): static
  207.     {
  208.         $this->googleExportedData $googleExportedData;
  209.         return $this;
  210.     }
  211. }