src/Entity/CalendarEvent.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\CalendarEvent\Status;
  4. use App\Enum\CalendarEvent\Type;
  5. use App\Enum\Student\VirtualStatus;
  6. use App\Library\Utils\StringUtils;
  7. use App\Repository\CalendarEventRepository;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. /**
  12.  * @ORM\Entity(repositoryClass=CalendarEventRepository::class)
  13.  */
  14. class CalendarEvent
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $name;
  26.     /**
  27.      * @ORM\Column(type="date")
  28.      */
  29.     private $startDate;
  30.     /**
  31.      * @ORM\Column(type="date")
  32.      */
  33.     private $endDate;
  34.     /**
  35.      * @ORM\Column(type="integer", nullable=true)
  36.      */
  37.     private $price;
  38.     /**
  39.      * @ORM\Column(type="smallint", nullable=true)
  40.      */
  41.     private $fromLevel;
  42.     /**
  43.      * @ORM\Column(type="smallint", nullable=true)
  44.      */
  45.     private $earnLevel;
  46.     /**
  47.      * @ORM\Column(type="time")
  48.      */
  49.     private $startTime;
  50.     /**
  51.      * @ORM\Column(type="time")
  52.      */
  53.     private $endTime;
  54.     /**
  55.      * @ORM\Column(type="enum", options={"values"="calendar_event_enum"})
  56.      */
  57.     private $type Type::TYPE_COURSE;
  58.     /**
  59.      * @ORM\Column(type="boolean", nullable=true)
  60.      */
  61.     private $isCandidateReviewRequired true;
  62.     /**
  63.     * @ORM\ManyToOne(targetEntity=PaymentRequisites::class)
  64.     * @ORM\JoinColumn(nullable=true)
  65.      */
  66.     private $paymentRequisites;
  67.     /**
  68.      * @ORM\Column(type="string", length=255, nullable=true)
  69.      */
  70.     private $telegramChannelUrl;
  71.     /**
  72.      * @ORM\Column(type="string", length=100, nullable=true)
  73.      */
  74.     private $telegramChannelId;
  75.     /**
  76.      * @ORM\ManyToMany(targetEntity=CalendarEvent::class)
  77.      */
  78.     private $requireCalendarEventsParticipations;
  79.     /**
  80.      * @ORM\Column(type="boolean", nullable=true)
  81.      */
  82.     private $eventDatesApproximate;
  83.     /**
  84.      * @ORM\Column(type="enum", options={"values"="calendar_event_enum", "default"="active"}))
  85.      */
  86.     private $status Status::STATUS_ACTIVE;
  87.     /**
  88.      * @ORM\ManyToMany(targetEntity=CalendarEvent::class)
  89.      * @ORM\JoinTable(name="calendar_event_deny_participations",
  90.      *       joinColumns={@ORM\JoinColumn(name="calendar_event_id", referencedColumnName="id")},
  91.      *       inverseJoinColumns={@ORM\JoinColumn(name="deny_calendar_event_id", referencedColumnName="id")}
  92.      *  )
  93.      */
  94.     private $denyCalendarEventsParticipations;
  95.     /**
  96.      * @ORM\Column(type="smallint", nullable=true)
  97.      */
  98.     private $toLevel;
  99.     /**
  100.      * @ORM\Column(nullable=true)
  101.      */
  102.     private $requireStudentStatus;
  103.     /**
  104.      * @ORM\ManyToOne(targetEntity=CalendarEvent::class, inversedBy="connectedCalendarEvents")
  105.      * @ORM\JoinColumn(nullable=true)
  106.      */
  107.     private $connectingCalendarEvent;
  108.     /**
  109.      * @ORM\OneToMany(targetEntity=CalendarEvent::class, mappedBy="connectingCalendarEvent")
  110.      */
  111.     private $connectedCalendarEvents;
  112.     /**
  113.      * @ORM\ManyToMany(targetEntity=TelegramCampaignMessage::class)
  114.      */
  115.     private $approvedCandidatesCampaignMessages;
  116.     /**
  117.      * @ORM\ManyToOne(targetEntity=CalendarEventKind::class)
  118.      */
  119.     private $kind;
  120.     /**
  121.      * @ORM\Column(type="boolean", nullable=true)
  122.      */
  123.     private $connectingEventForAccountant;
  124.     public function __construct()
  125.     {
  126.         $this->startDate = new \DateTime();
  127.         $this->endDate = new \DateTime();
  128.         $this->startTime = new \DateTime('10:00:00');
  129.         $this->endTime = new \DateTime('13:00:00');
  130.         $this->requireCalendarEventsParticipations = new ArrayCollection();
  131.         $this->approvedCandidatesCampaignMessages = new ArrayCollection();
  132.         $this->denyCalendarEventsParticipations = new ArrayCollection();
  133.         $this->connectedCalendarEvents = new ArrayCollection();
  134.     }
  135.     public function __toString()
  136.     {
  137.         return $this->getNameText();
  138.     }
  139.     public function getShortInfo(): string
  140.     {
  141.         return $this->getName() . " " . ($this->getStartDate() ? $this->getStartDate()->format('d.m.Y') : "") .
  142.             ($this->getFromLevel() ? " (с " $this->getFromLevel() . " ур.)" " (все ур.)");
  143.     }
  144.     public function getText(array $options null)
  145.     {
  146.         $options array_merge([
  147.             "quotes" => false,
  148.         ], $options ?? []);
  149.         $result = ($options['quotes'] ? $this->getNameText() : $this->getName());
  150.         return $result;
  151.     }
  152.     public function getNameText(): string
  153.     {
  154.         return $this->getTypeText() . " «" $this->getName() . "»";
  155.     }
  156.     public function getOnTypeText(): string
  157.     {
  158.         $typeText null;
  159.         switch ($this->getType()) {
  160.             case Type::TYPE_COURSE:
  161.                 $typeText "курс";
  162.                 break;
  163.             case Type::TYPE_OPEN_MEETING:
  164.                 $typeText "открытую встречу";
  165.                 break;
  166.             case Type::TYPE_MEETING:
  167.                 $typeText "конференцию";
  168.                 break;
  169.             case Type::TYPE_PERSONAL_CONSULTATION:
  170.                 $typeText "личную консультациию";
  171.                 break;
  172.             default:
  173.                 $typeText $this->getTypeText();
  174.                 break;
  175.         }
  176.         return $typeText;
  177.     }
  178.     public function getOfTypeText(): string
  179.     {
  180.         $typeText null;
  181.         switch ($this->getType()) {
  182.             case Type::TYPE_COURSE:
  183.                 $typeText "курса";
  184.                 break;
  185.                 case Type::TYPE_OPEN_MEETING:
  186.                 $typeText "открытой встречи";
  187.                 break;
  188.             case Type::TYPE_MEETING:
  189.                 $typeText "конференции";
  190.                 break;
  191.             case Type::TYPE_PERSONAL_CONSULTATION:
  192.                 $typeText "личной консультации";
  193.                 break;
  194.             default:
  195.                 $typeText $this->getTypeText();
  196.                 break;
  197.         }
  198.         return $typeText;
  199.     }
  200.     public function getOnNameText(): string
  201.     {
  202.         $typeText $this->getOnTypeText();
  203.         return $typeText " «" $this->getName() . "»";
  204.     }
  205.     public function getOfNameText(): string
  206.     {
  207.         $typeText $this->getOfTypeText();
  208.         return $typeText " «" $this->getName() . "»";
  209.     }
  210.     public function getId(): ?int
  211.     {
  212.         return $this->id;
  213.     }
  214.     public function getName(): ?string
  215.     {
  216.         return $this->name;
  217.     }
  218.     public function setName(string $name): self
  219.     {
  220.         $this->name $name;
  221.         return $this;
  222.     }
  223.     public function getStartDate(): ?\DateTimeInterface
  224.     {
  225.         return $this->startDate;
  226.     }
  227.     public function setStartDate(\DateTimeInterface $startDate): self
  228.     {
  229.         $this->startDate $startDate;
  230.         return $this;
  231.     }
  232.     public function getEndDate(): ?\DateTimeInterface
  233.     {
  234.         return $this->endDate;
  235.     }
  236.     public function setEndDate(\DateTimeInterface $endDate): self
  237.     {
  238.         $this->endDate $endDate;
  239.         return $this;
  240.     }
  241.     private function _getPrice($isFirstCall false): ?int
  242.     {
  243.         if ($isFirstCall) {
  244.             if (!$this->_getPrice() && $this->getConnectedCalendarEvents()->count()) {
  245.                 $isAllPricesEqual true;
  246.                 $price null;
  247.                 foreach ($this->getConnectedCalendarEvents() as $connectedEvent) {
  248.                     if ($connectedEvent->_getPrice()) {
  249.                         if ($price === null) {
  250.                             $price $connectedEvent->_getPrice();
  251.                         } elseif ($price != $connectedEvent->_getPrice()) {
  252.                             $isAllPricesEqual false;
  253.                             break;
  254.                         }
  255.                     }
  256.                 }
  257.                 if ($isAllPricesEqual) {
  258.                     return $price;
  259.                 }
  260.             }
  261.         }
  262.         return $this->price;
  263.     }
  264.     public function getPrice(): ?int
  265.     {
  266.       return $this->_getPrice(true);
  267.     }
  268.     public function setPrice(?int $price): self
  269.     {
  270.         $this->price $price;
  271.         return $this;
  272.     }
  273.     public function getFromLevel(): ?int
  274.     {
  275.         return $this->fromLevel;
  276.     }
  277.     public function getFromLevelEmoji(): string
  278.     {
  279.         $level $this->getFromLevel();
  280.         if ($level === null || $level === 0) {
  281.             return "🔢";
  282.         }
  283.         $emojiNumbers = [
  284.             '0' => '0️⃣',
  285.             '1' => '1️⃣',
  286.             '2' => '2️⃣',
  287.             '3' => '3️⃣',
  288.             '4' => '4️⃣',
  289.             '5' => '5️⃣',
  290.             '6' => '6️⃣',
  291.             '7' => '7️⃣',
  292.             '8' => '8️⃣',
  293.             '9' => '9️⃣',
  294.         ];
  295.         $levelStr = (string)$level;
  296.         return $emojiNumbers[$levelStr[0]] . ($levelStr[1] ?? '');
  297.     }
  298.     public function getFromLevelText(): string
  299.     {
  300.         if ($this->getFromLevel() === null) {
  301.             return "";
  302.         }
  303.         if ($this->getFromLevel() === 0) {
  304.             return "все ур.";
  305.         }
  306.         return "с" StringUtils::getEnding($this->getFromLevel(),
  307.                 """о""",
  308.                 "")
  309.             . " " . (string)$this->getFromLevel() . " ур.";
  310.     }
  311.     public function setFromLevel(?int $fromLevel): self
  312.     {
  313.         $this->fromLevel $fromLevel;
  314.         return $this;
  315.     }
  316.     public function getEarnLevel(): ?int
  317.     {
  318.         return $this->earnLevel;
  319.     }
  320.     public function setEarnLevel(?int $level): self
  321.     {
  322.         $this->earnLevel $level;
  323.         return $this;
  324.     }
  325.     public function getStartTime(): ?\DateTimeInterface
  326.     {
  327.         return $this->startTime;
  328.     }
  329.     public function setStartTime(\DateTimeInterface $startTime): self
  330.     {
  331.         $this->startTime $startTime;
  332.         return $this;
  333.     }
  334.     public function getEndTime(): ?\DateTimeInterface
  335.     {
  336.         return $this->endTime;
  337.     }
  338.     public function setEndTime(\DateTimeInterface $endTime): self
  339.     {
  340.         $this->endTime $endTime;
  341.         return $this;
  342.     }
  343.     public function getType()
  344.     {
  345.         return $this->type;
  346.     }
  347.     public function getTypeText(): string
  348.     {
  349.         return Type::getText($this->getType());
  350.     }
  351.     public function setType($type): self
  352.     {
  353.         $this->type $type;
  354.         return $this;
  355.     }
  356.     public function getTopic(): string
  357.     {
  358.         if ($this->type === Type::TYPE_COURSE) {
  359.             return "Курс «" $this->getName() . "»";
  360.         } elseif ($this->type === Type::TYPE_MEETING) {
  361.             return "Конференция «" $this->getName() . "»";
  362.         } elseif ($this->type === Type::TYPE_OPEN_MEETING) {
  363.             return "Открытая встреча «" $this->getName() . "»";
  364.         } else {
  365.             return $this->getTypeText() . " «" $this->getName() . "»";
  366.         }
  367.     }
  368.     public function isIsCandidateReviewRequired(): ?bool
  369.     {
  370.         return $this->isCandidateReviewRequired;
  371.     }
  372.     public function setIsCandidateReviewRequired(?bool $isCandidateReviewRequired): self
  373.     {
  374.         $this->isCandidateReviewRequired $isCandidateReviewRequired;
  375.         return $this;
  376.     }
  377.     public function getPaymentRequisites(): ?PaymentRequisites
  378.     {
  379.         return $this->paymentRequisites;
  380.     }
  381.     public function setPaymentRequisites(?PaymentRequisites $paymentRequisites): self
  382.     {
  383.         $this->paymentRequisites $paymentRequisites;
  384.         return $this;
  385.     }
  386.     public function getNameWithCode(): string
  387.     {
  388.         return "Код " $this->getPrice() . " – " $this->getShortInfo();
  389.     }
  390.     public function isFinished(): bool
  391.     {
  392.         if (!$this->getFullEndDate()) {
  393.             return true;
  394.         }
  395.         $now = new \DateTime();
  396.         return $this->getFullEndDate() < $now;
  397.     }
  398.     public function isInProgress(): bool
  399.     {
  400.         return $this->isStarted() && !$this->isFinished();
  401.     }
  402.     public function isUpcoming(): bool
  403.     {
  404.         if (!$this->getFullStartDate()) {
  405.             return false;
  406.         }
  407.         $now = new \DateTime();
  408.         return $this->getFullStartDate() > $now;
  409.     }
  410.     public function getFullStartDate(): ?\DateTime
  411.     {
  412.         $startDate $this->getStartDate();
  413.         if (!$startDate) {
  414.             return null;
  415.         }
  416.         $startTime $this->getStartTime();
  417.         if ($startTime) {
  418.             $startDate = (clone $startDate)->setTime($startTime->format('H'), $startTime->format('i'), $startTime->format('s'));
  419.         }
  420.         return $startDate;
  421.     }
  422.     public function getFullEndDate(): ?\DateTime
  423.     {
  424.         $endDate $this->getEndDate();
  425.         if (!$endDate) {
  426.             return null;
  427.         }
  428.         $endTime $this->getEndTime();
  429.         if ($endTime) {
  430.             $endDate = (clone $endDate)->setTime($endTime->format('H'), $endTime->format('i'), $endTime->format('s'));
  431.         }
  432.         return $endDate;
  433.     }
  434.     public function isStarted(int $addDaysToStartDate null): bool
  435.     {
  436.         if (!$this->getStartDate() || $this->isFinished()) {
  437.             return false;
  438.         }
  439.         $now = (new \DateTime())->setTime(000);
  440.         $startDate = (clone $this->getStartDate())->setTime(000);
  441.         if ($addDaysToStartDate) {
  442.             $startDate $startDate->modify("+$addDaysToStartDate days");
  443.         }
  444.         return $startDate <= $now;
  445.     }
  446.     public function isRegistrationOpen(): bool
  447.     {
  448.         return !$this->isStarted(-2);
  449.     }
  450.     public function getLastRegistrationDate(): ?\DateTime
  451.     {
  452.         if (!$this->getStartDate()) {
  453.             return null;
  454.         }
  455.         $lastRegistrationDate = (clone $this->getStartDate())->modify("-3 days");
  456.         $weekendDays 0;
  457.         if (in_array((int)$lastRegistrationDate->format('N'), [67])) {
  458.             $weekendDays = (int)$lastRegistrationDate->format('N') - 5;
  459.         }
  460.         if ($weekendDays 0) {
  461.             $lastRegistrationDate $lastRegistrationDate->modify("-$weekendDays days");
  462.         }
  463.         return $lastRegistrationDate;
  464.     }
  465.     public function getHoursLeftBeforeStart(): int
  466.     {
  467.         return (int)ceil((($this->getStartDate()->getTimestamp() - (new \DateTime())->getTimestamp()) / 3600));
  468.     }
  469.     public function getTelegramChannelUrl(): ?string
  470.     {
  471.         return $this->telegramChannelUrl;
  472.     }
  473.     public function setTelegramChannelUrl(?string $telegramChannelUrl): self
  474.     {
  475.         $this->telegramChannelUrl $telegramChannelUrl;
  476.         return $this;
  477.     }
  478.     public function getTelegramChannelId(): ?string
  479.     {
  480.         return $this->telegramChannelId;
  481.     }
  482.     public function setTelegramChannelId(?string $telegramChannelId): self
  483.     {
  484.         $this->telegramChannelId $telegramChannelId;
  485.         return $this;
  486.     }
  487.     /**
  488.      * @return Collection<int, self>
  489.      */
  490.     public function getRequireCalendarEventsParticipations(): Collection
  491.     {
  492.         return $this->requireCalendarEventsParticipations;
  493.     }
  494.     public function getRequireCalendarEventsParticipationsText(): string
  495.     {
  496.         $texts = [];
  497.         foreach ($this->getRequireCalendarEventsParticipations() as $event) {
  498.             $texts[] = mb_lcfirst($event->getNameText(), 'UTF-8');
  499.         }
  500.         return implode(", "$texts);
  501.     }
  502.     public function getDenyCalendarEventsParticipationsText(): string
  503.     {
  504.         $texts = [];
  505.         foreach ($this->getDenyCalendarEventsParticipations() as $event) {
  506.             $texts[] = mb_lcfirst($event->getNameText(), 'UTF-8');
  507.         }
  508.         return implode(", "$texts);
  509.     }
  510.     public function addRequireCalendarEventsParticipation(self $requireCalendarEventsParticipation): self
  511.     {
  512.         if (!$this->requireCalendarEventsParticipations->contains($requireCalendarEventsParticipation)) {
  513.             $this->requireCalendarEventsParticipations[] = $requireCalendarEventsParticipation;
  514.         }
  515.         return $this;
  516.     }
  517.     public function removeRequireCalendarEventsParticipation(self $requireCalendarEventsParticipation): self
  518.     {
  519.         $this->requireCalendarEventsParticipations->removeElement($requireCalendarEventsParticipation);
  520.         return $this;
  521.     }
  522.     public function isStudentLevelCorrespond(?Person $person): bool
  523.     {
  524.         if (!$person) {
  525.             return false;
  526.         }
  527.         $eventLevel $this->getFromLevel();
  528.         if ($eventLevel === null) {
  529.             return true;
  530.         }
  531.         if (!$person->getStudent() || $person->getStudent()->getLevel() === null) {
  532.             return false;
  533.         }
  534.         return $person->getStudent()->getLevel() >= $eventLevel;
  535.     }
  536.     public function isEventDatesApproximate(): ?bool
  537.     {
  538.         return $this->eventDatesApproximate;
  539.     }
  540.     public function setEventDatesApproximate(?bool $eventDatesApproximate): self
  541.     {
  542.         $this->eventDatesApproximate $eventDatesApproximate;
  543.         return $this;
  544.     }
  545. //    /**
  546. //     * @return Collection<int, TelegramCampaignMessage>
  547. //     */
  548. //    public function getApprovedCandidatesCampaignMessages(): Collection
  549. //    {
  550. //        return $this->approvedCandidatesCampaignMessages;
  551. //    }
  552. //
  553. //    public function addApprovedCandidatesCampaignMessage(TelegramCampaignMessage $approvedCandidatesCampaignMessage): self
  554. //    {
  555. //        if (!$this->approvedCandidatesCampaignMessages->contains($approvedCandidatesCampaignMessage)) {
  556. //            $this->approvedCandidatesCampaignMessages[] = $approvedCandidatesCampaignMessage;
  557. //        }
  558. //
  559. //        return $this;
  560. //    }
  561. //
  562. //    public function removeApprovedCandidatesCampaignMessage(TelegramCampaignMessage $approvedCandidatesCampaignMessage): self
  563. //    {
  564. //        $this->approvedCandidatesCampaignMessages->removeElement($approvedCandidatesCampaignMessage);
  565. //
  566. //        return $this;
  567. //    }
  568.     public function getStatus()
  569.     {
  570.         return $this->status;
  571.     }
  572.     public function setStatus($status): self
  573.     {
  574.         $this->status $status;
  575.         return $this;
  576.     }
  577.     public function getStatusText(): ?string
  578.     {
  579.         return Status::getText($this->getStatus());
  580.     }
  581.     public function getStatusCssClass($prefix null): ?string
  582.     {
  583.         return Status::getCssClass($this->getStatus(), $prefix);
  584.     }
  585.     /**
  586.      * @return Collection<int, self>
  587.      */
  588.     public function getDenyCalendarEventsParticipations(): Collection
  589.     {
  590.         return $this->denyCalendarEventsParticipations;
  591.     }
  592.     public function addDenyCalendarEventsParticipation(self $denyCalendarEventsParticipation): self
  593.     {
  594.         if (!$this->denyCalendarEventsParticipations->contains($denyCalendarEventsParticipation)) {
  595.             $this->denyCalendarEventsParticipations[] = $denyCalendarEventsParticipation;
  596.         }
  597.         return $this;
  598.     }
  599.     public function removeDenyCalendarEventsParticipation(self $denyCalendarEventsParticipation): self
  600.     {
  601.         $this->denyCalendarEventsParticipations->removeElement($denyCalendarEventsParticipation);
  602.         return $this;
  603.     }
  604.     public function getToLevel(): ?int
  605.     {
  606.         return $this->toLevel;
  607.     }
  608.     public function setToLevel(?int $toLevel): self
  609.     {
  610.         $this->toLevel $toLevel;
  611.         return $this;
  612.     }
  613.     public function getRequireStudentStatus()
  614.     {
  615.         return $this->requireStudentStatus;
  616.     }
  617.     public function getRequireStudentStatusText(): string
  618.     {
  619.         return VirtualStatus::getText($this->getRequireStudentStatus());
  620.     }
  621.     public function setRequireStudentStatus($requireStudentStatus): self
  622.     {
  623.         $this->requireStudentStatus $requireStudentStatus;
  624.         return $this;
  625.     }
  626.     public function getConnectingCalendarEvent(): ?self
  627.     {
  628.         return $this->connectingCalendarEvent;
  629.     }
  630.     public function setConnectingCalendarEvent(?self $connectingCalendarEvent): self
  631.     {
  632.         $this->connectingCalendarEvent $connectingCalendarEvent;
  633.         return $this;
  634.     }
  635.     /**
  636.      * @return Collection<int, self>
  637.      */
  638.     public function getConnectedCalendarEvents(): Collection
  639.     {
  640.         return $this->connectedCalendarEvents;
  641.     }
  642.     public function addConnectedCalendarEvent(self $connectedCalendarEvent): self
  643.     {
  644.         if (!$this->connectedCalendarEvents->contains($connectedCalendarEvent)) {
  645.             $this->connectedCalendarEvents[] = $connectedCalendarEvent;
  646.             $connectedCalendarEvent->setConnectingCalendarEvent($this);
  647.         }
  648.         return $this;
  649.     }
  650.     public function removeConnectedCalendarEvent(self $connectedCalendarEvent): self
  651.     {
  652.         if ($this->connectedCalendarEvents->removeElement($connectedCalendarEvent)) {
  653.             // set the owning side to null (unless already changed)
  654.             if ($connectedCalendarEvent->getConnectingCalendarEvent() === $this) {
  655.                 $connectedCalendarEvent->setConnectingCalendarEvent(null);
  656.             }
  657.         }
  658.         return $this;
  659.     }
  660.     public function getKind(): ?CalendarEventKind
  661.     {
  662.         return $this->kind;
  663.     }
  664.     public function setKind(?CalendarEventKind $kind): self
  665.     {
  666.         $this->kind $kind;
  667.         return $this;
  668.     }
  669.     public function getFinanceCategory(): ?FinanceCategory
  670.     {
  671.         $ceKind $this->getKind();
  672.         return $ceKind $ceKind->getFinanceCategory() : null;
  673.     }
  674.     public function isSameFinanceCategory(FinanceCategory $financeCategory): bool
  675.     {
  676.         $ceFinanceCategory $this->getFinanceCategory();
  677.         if (!$ceFinanceCategory) {
  678.             return false;
  679.         }
  680.         return $ceFinanceCategory->getId() === $financeCategory->getId();
  681.     }
  682.     public function isConnectingType(): bool
  683.     {
  684.         return $this->getType() == Type::TYPE_CONNECTING_EVENT;
  685.     }
  686.     public function isConnectingEventForAccountant(): ?bool
  687.     {
  688.         return $this->connectingEventForAccountant;
  689.     }
  690.     public function setConnectingEventForAccountant(?bool $connectingEventForAccountant): self
  691.     {
  692.         $this->connectingEventForAccountant $connectingEventForAccountant;
  693.         return $this;
  694.     }
  695. }