src/Entity/Channel/ChannelConfiguration.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Channel;
  3. use App\Entity\Account\User;
  4. use App\Entity\Sync\SyncableInterface;
  5. use App\Repository\Channel\ChannelConfigurationRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Drosalys\Bundle\ApiBundle\Serializer\Attributes\IdGroups;
  10. use Nellapp\Bundle\SDKBundle\Channel\Entity\Configuration\BaseChannelConfigurationInterface;
  11. use Nellapp\Bundle\SDKBundle\Channel\Entity\Configuration\BaseChannelConfigurationMethodTrait;
  12. use Nellapp\Bundle\SDKBundle\Channel\Entity\Configuration\ELearningChannelConfigurationInterface;
  13. use Nellapp\Bundle\SDKBundle\Channel\Entity\Configuration\ELearningChannelConfigurationMethodTrait;
  14. use Nellapp\Bundle\SDKBundle\Channel\Entity\Configuration\PlanningChannelConfigurationInterface;
  15. use Nellapp\Bundle\SDKBundle\Channel\Entity\Configuration\PlanningChannelConfigurationMethodTrait;
  16. use Nellapp\Bundle\SDKBundle\Sync\EntityKeys;
  17. use Symfony\Component\Serializer\Annotation as Serial;
  18. use Symfony\Component\Validator\Constraints as Assert;
  19. #[
  20.     ORM\Entity(repositoryClassChannelConfigurationRepository::class),
  21.     ORM\Table(name'channel_configuration')
  22. ]
  23. class ChannelConfiguration implements BaseChannelConfigurationInterfacePlanningChannelConfigurationInterfaceELearningChannelConfigurationInterfaceSyncableInterface
  24. {
  25.     use BaseChannelConfigurationMethodTrait;
  26.     use PlanningChannelConfigurationMethodTrait;
  27.     use ELearningChannelConfigurationMethodTrait;
  28.     #[ORM\IdORM\GeneratedValueORM\Column(type'integer'nullablefalse)]
  29.     #[Serial\Groups(['Sync'])]
  30.     private ?int $id null;
  31.     #[ORM\OneToOne(mappedBy'configuration'targetEntityChannel::class, fetch'EAGER')]
  32.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  33.     #[IdGroups(['Sync'])]
  34.     private ?Channel $channel null;
  35.     #[ORM\Column(type'string'length50nullabletrue)]
  36.     #[Assert\Timezone(
  37.         message'channel.configuration.timezone.Timezone',
  38.     )]
  39.     #[Serial\Groups(['Sync'])]
  40.     private ?string $timezone null;
  41.     #[ORM\ManyToOne(targetEntityUser::class)]
  42.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  43.     #[IdGroups(['Sync'])]
  44.     private ?User $defaultReferralTrainer null;
  45.     #[ORM\Column(type'boolean'nullablefalseoptions: ['default' => false])]
  46.     private bool $showPositioningTestResults false;
  47.     #[ORM\Column(type'simple_array'nullablefalseoptions: ['default' => '1,2,3,4,5'])]
  48.     #[Assert\NotBlank]
  49.     #[Serial\Groups(['Sync'])]
  50.     private array $planningDays = [12345];
  51.     #[ORM\Column(type'boolean'nullablefalseoptions: ['default' => false])]
  52.     #[Serial\Groups(['Sync'])]
  53.     private bool $enabledConference false;
  54.     #[ORM\Column(type'boolean'nullablefalseoptions: ['default' => false])]
  55.     private bool $enabledPartnerApiIndex false;
  56.     #[ORM\ManyToOne(targetEntityUser::class, fetch'EAGER')]
  57.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  58.     private ?User $commercialUser null;
  59.     #[ORM\Column(type'boolean'nullablefalseoptions: ['default' => false])]
  60.     #[Serial\Groups(['Sync'])]
  61.     private bool $enabledConferenceByDefaultOnEvents false;
  62.     #[ORM\Column(type'boolean'nullablefalseoptions: ['default' => false])]
  63.     #[Serial\Groups(['Sync'])]
  64.     private bool $enabledSigningModalityEvents false;
  65.     #[ORM\Column(type'boolean'nullablefalseoptions: ['default' => false])]
  66.     #[Serial\Groups(['Sync'])]
  67.     private bool $askForReferentCorrection false;
  68.     #[ORM\Column(type'boolean'nullablefalseoptions: ['default' => false])]
  69.     #[Serial\Groups(['Sync'])]
  70.     private bool $enableCustomTimeOnPracticalCase false;
  71.     #[ORM\Column(type'boolean'nullablefalseoptions: ['default' => false])]
  72.     #[Serial\Groups(['Sync'])]
  73.     private bool $enableBunnyStream false;
  74.     #[ORM\Column(type'string'nullabletrue)]
  75.     private ?string $zapierWebhookUrl null;
  76.     #[ORM\Column(type'boolean'nullablefalseoptions: ['default' => false])]
  77.     #[Serial\Groups(['Sync'])]
  78.     private bool $enabledCrm false;
  79.     /** @var Collection<int, Service> */
  80.     #[ORM\ManyToMany(targetEntityService::class)]
  81.     #[ORM\JoinTable(name'channel_configuration_dsf_services')]
  82.     #[IdGroups(['Sync'])]
  83.     private Collection $dsfServicesToNotify;
  84.     public function __construct()
  85.     {
  86.         $this->dsfServicesToNotify = new ArrayCollection();
  87.     }
  88.     public static function getSyncKey(): string
  89.     {
  90.         return EntityKeys::CHANNEL_CONFIGURATION;
  91.     }
  92.     public function getSyncDisplayLabel(): string
  93.     {
  94.         return $this->getChannel() . ' - configuration';
  95.     }
  96.     public function getShowPositioningTestResults(): bool
  97.     {
  98.         return $this->showPositioningTestResults;
  99.     }
  100.     public function setShowPositioningTestResults(bool $showPositioningTestResults): static
  101.     {
  102.         $this->showPositioningTestResults $showPositioningTestResults;
  103.         return $this;
  104.     }
  105.     public function toggleEnabledConference(): static
  106.     {
  107.         $this->enabledConference = !$this->enabledConference;
  108.         return $this;
  109.     }
  110.     public function isEnabledPartnerApiIndex(): bool
  111.     {
  112.         return $this->enabledPartnerApiIndex;
  113.     }
  114.     public function setEnabledPartnerApiIndex(bool $enabledPartnerApiIndex): static
  115.     {
  116.         $this->enabledPartnerApiIndex $enabledPartnerApiIndex;
  117.         return $this;
  118.     }
  119.     public function toggleEnabledPartnerApiIndex(): static
  120.     {
  121.         $this->enabledPartnerApiIndex = !$this->enabledPartnerApiIndex;
  122.         return $this;
  123.     }
  124.     public function getCommercialUser(): ?User
  125.     {
  126.         return $this->commercialUser;
  127.     }
  128.     public function setCommercialUser(?User $commercialUser): ChannelConfiguration
  129.     {
  130.         $this->commercialUser $commercialUser;
  131.         return $this;
  132.     }
  133.     public function getZapierWebhookUrl(): ?string
  134.     {
  135.         return $this->zapierWebhookUrl;
  136.     }
  137.     public function setZapierWebhookUrl(?string $zapierWebhookUrl): ChannelConfiguration
  138.     {
  139.         $this->zapierWebhookUrl $zapierWebhookUrl;
  140.         return $this;
  141.     }
  142.     public function toggleEnabledCrm(): static
  143.     {
  144.         $this->enabledCrm = !$this->enabledCrm;
  145.         return $this;
  146.     }
  147.     public function isEnableCustomTimeOnPracticalCase(): bool
  148.     {
  149.         return $this->enableCustomTimeOnPracticalCase;
  150.     }
  151.     public function setEnableCustomTimeOnPracticalCase(bool $enableCustomTimeOnPracticalCase): static
  152.     {
  153.         $this->enableCustomTimeOnPracticalCase $enableCustomTimeOnPracticalCase;
  154.         return $this;
  155.     }
  156.     /** @return Collection<int, Service> */
  157.     public function getDsfServicesToNotify(): Collection
  158.     {
  159.         return $this->dsfServicesToNotify ?? new ArrayCollection();
  160.     }
  161.     public function addDsfServicesToNotify(Service $service): static
  162.     {
  163.         if (!$this->dsfServicesToNotify->contains($service)) {
  164.             $this->dsfServicesToNotify->add($service);
  165.         }
  166.         return $this;
  167.     }
  168.     public function removeDsfServicesToNotify(Service $service): static
  169.     {
  170.         $this->dsfServicesToNotify->removeElement($service);
  171.         return $this;
  172.     }
  173. }