src/Entity/TvCompany.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Annotation\SerializedNameGroups;
  4. use App\Repository\TvCompanyRepository;
  5. use App\Security\UserChecker;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. /**
  12.  * @ORM\Entity(repositoryClass=TvCompanyRepository::class)
  13.  * @ORM\HasLifecycleCallbacks()
  14.  */
  15. class TvCompany
  16. {
  17.     const STATUS_ACTIVE 'active';
  18.     const STATUS_EXPIRED 'expired';
  19.     const STATUS_SUSPENDED 'suspended';
  20.     const STATUS_INACTIVE 'deactivated';
  21.     const MESSAGE_RESTRICTION 'restricted_msg';
  22.     const MESSAGE_QUOTAS 'restricted_msg';
  23.     const MESSAGE_DEFAULT 'default';
  24.     const STATUSES = [
  25.         self::STATUS_INACTIVE,
  26.         self::STATUS_EXPIRED,
  27.         self::STATUS_SUSPENDED,
  28.         self::STATUS_ACTIVE,
  29.     ];
  30.     /**
  31.      * @ORM\Id
  32.      * @ORM\GeneratedValue
  33.      * @ORM\Column(type="integer")
  34.      * @Groups({"tv_company_read", "export_csv", "simple_company", "video_read", "message_read", "tv_user_tv_company_read", "company_form", 
  35.      *      "award_read", "team_read", "team_user_read", "notification_read"
  36.      * })
  37.      */
  38.     private $id;
  39.     /**
  40.      * @ORM\Column(type="string", length=255)
  41.      * @Groups({"tv_user_read", "tv_company_read", "tv_company_write", "export_csv", "message_read", "tv_user_tv_company_read",
  42.      *      "tv_user_read_creation", "simple_company", "video_read", "category_read", "channel_read", "company_form",
  43.      *      "video_form_complete", "manager_dashboard", "award_read", "program_edit", "team_read", "team_user_read", 
  44.      *      "team_simple", "teamplay_read", "notification_read"
  45.      * })
  46.      * @Assert\NotBlank()
  47.      * @SerializedNameGroups(name="Nom", groups={"tv_user_read_creation", "team_simple"})
  48.      */
  49.     private $name;
  50.     /**
  51.      * @ORM\Column(type="string", length=255)
  52.      * @Groups({"tv_user_read", "tv_company_read", "tv_company_write", "export_csv", "manager_dashboard"})
  53.      * @Assert\NotBlank()
  54.      */
  55.     private $addressLine;
  56.     /**
  57.      * @ORM\Column(type="string", length=255)
  58.      * @Groups({"tv_user_read", "tv_company_read", "tv_company_write", "export_csv"})
  59.      * @Assert\NotBlank()
  60.      */
  61.     private $city;
  62.     /**
  63.      * @ORM\Column(type="string", length=20)
  64.      * @Groups({"tv_user_read", "tv_company_read", "tv_company_write", "export_csv"})
  65.      * @Assert\NotBlank()
  66.      */
  67.     private $zipCode;
  68.     /**
  69.      * @ORM\Column(type="string", length=100)
  70.      * @Groups({"tv_user_read", "tv_company_read", "tv_company_write", "export_csv"})
  71.      * @Assert\NotBlank()
  72.      */
  73.     private $country;
  74.     /**
  75.      * @ORM\Column(type="string", length=255)
  76.      * @Groups({"tv_company_read", "tv_company_write", "export_csv", "manager_dashboard"})
  77.      * @Assert\NotBlank()
  78.      */
  79.     private $managerFirstName;
  80.     /**
  81.      * @ORM\Column(type="string", length=255)
  82.      * @Groups({"tv_company_read", "tv_company_write", "export_csv", "manager_dashboard"})
  83.      * @Assert\NotBlank()
  84.      */
  85.     private $managerLastName;
  86.     /**
  87.      * @ORM\Column(type="string", length=255)
  88.      * @Groups({"tv_company_read", "tv_company_write", "export_csv", "manager_dashboard"})
  89.      * @Assert\NotBlank()
  90.      */
  91.     private $managerFunction;
  92.     /**
  93.      * @ORM\Column(type="string", length=255)
  94.      * @Groups({"tv_company_read", "tv_company_write", "export_csv", "manager_dashboard"})
  95.      * @Assert\NotBlank()
  96.      * @Assert\Length(min=8, max=20, minMessage="phone.min", maxMessage="phone.max")
  97.      * @Assert\Regex(pattern="/^(?:(?:\+|00)33|0)\s*[1-9](?:[\s.-]*\d{2}){4}$/i", message="phone.regex")
  98.      */
  99.     private $managerPhone;
  100.     /**
  101.      * @ORM\Column(type="string", length=255)
  102.      * @Groups({"tv_company_read", "tv_company_write", "export_csv", "manager_dashboard"})
  103.      * @Assert\NotBlank()
  104.      */
  105.     private $managerEmail;
  106.     /**
  107.      * @ORM\Column(type="string", length=255)
  108.      * @Groups({"tv_company_read", "tv_company_write", "export_csv", "manager_dashboard"})
  109.      * @Assert\NotBlank()
  110.      */
  111.     private $siren;
  112.     /**
  113.      * @ORM\Column(type="string", length=255)
  114.      * @Groups({"tv_company_read", "tv_company_write", "export_csv", "manager_dashboard"})
  115.      * @Assert\Choice(choices=self::STATUSES)
  116.      */
  117.     private $status self::STATUS_ACTIVE;
  118.     /**
  119.      * @ORM\Column(type="boolean", options={"default": 1})
  120.      * @Groups({"tv_company_read", "notification_read"})
  121.      */
  122.     private $active true;
  123.     /**
  124.      * @ORM\OneToMany(targetEntity=TvUser::class, mappedBy="tvCompany", cascade={"persist", "refresh", "remove"})
  125.      * @Groups({"tv_company_read"})
  126.      */
  127.     private $tvUsers;
  128.     /**
  129.      * @ORM\OneToMany(targetEntity=Restriction::class, mappedBy="tvCompany", orphanRemoval=true, cascade={"remove"})
  130.      * @Groups({"tv_company_read"})
  131.      */
  132.     private $restrictions;
  133.     /**
  134.      * @ORM\OneToMany(targetEntity=Order::class, mappedBy="tvCompany", cascade={"remove"})
  135.      * @Groups({"tv_company_read"})
  136.      */
  137.     private $orders;
  138.     /**
  139.      * @ORM\ManyToOne(targetEntity=MediaObject::class)
  140.      * @Groups({"tv_company_read", "tv_company_write", "tv_user_tv_company_read", "manager_dashboard"})
  141.      */
  142.     private $logo;
  143.     /**
  144.      * @ORM\Column(type="datetime")
  145.      */
  146.     private $createdAt;
  147.     /**
  148.      * @ORM\Column(type="datetime")
  149.      */
  150.     private $updatedAt;
  151.     /**
  152.      * @ORM\Column(type="datetime", nullable=true)
  153.      * @Groups({"tv_company_read", "tv_company_write", "export_csv", "manager_dashboard"})
  154.      */
  155.     private $subscriptionStart;
  156.     /**
  157.      * @ORM\Column(type="datetime", nullable=true)
  158.      * @Groups({"tv_company_read", "tv_company_write", "export_csv", "manager_dashboard"})
  159.      */
  160.     private $subscriptionEnd;
  161.     /**
  162.      * @ORM\Column(type="integer")
  163.      * @Groups({"tv_company_read", "export_csv"})
  164.      */
  165.     private $tvUsersCount 0;
  166.     /**
  167.      * Restriction messages if an tvUser bypasses any restrictions
  168.      * A 'default' message key will be used if the message has not been customized
  169.      * @ORM\Column(type="array")
  170.      * @Groups({"tv_company_read", "tv_company_write"})
  171.      */
  172.     private $messages = [self::MESSAGE_DEFAULT => UserChecker::QUOTAS_MESSAGE];
  173.     /**
  174.      * Maximum users allowed for the tvCompany
  175.      * @ORM\Column(type="integer", nullable=true)
  176.      * @Groups({"tv_company_read", "tv_company_write"})
  177.      */
  178.     private $maxUsers;
  179.     /**
  180.      * Forfait heure / forfait visionnage
  181.      * @ORM\Column(type="string", length=255, nullable=true)
  182.      * @Groups({"tv_company_read", "tv_company_write"})
  183.      */
  184.     private $plan;
  185.     /**
  186.      * Domain corresponding to this tvCompany ex:
  187.      * "orange.ulteam-tv.fr" will match tvCompany "Orange"
  188.      * @ORM\Column(type="string", length=255)
  189.      * @Groups({"tv_company_read", "tv_company_write"})
  190.      * @Assert\NotBlank
  191.      */
  192.     private $slug;
  193.     /**
  194.      * Restriction par IP
  195.      * @ORM\Column(type="array", nullable=true)
  196.      * @Groups({"tv_company_read", "tv_company_write"})
  197.      */
  198.     private $ips = [];
  199.     /**
  200.      * Restriction par domaine mail
  201.      * @ORM\Column(type="array", nullable=true)
  202.      * @Groups({"tv_company_read", "tv_company_write"})
  203.      */
  204.     private $domain = [];
  205.     /**
  206.      * Restriction heure de visionnage par utilisateur (5h)
  207.      * @ORM\Column(type="integer", nullable=true)
  208.      * @Groups({"tv_company_read", "tv_company_write"})
  209.      */
  210.     private $hourlyRestriction;
  211.     /**
  212.      * Restriction par code
  213.      * @ORM\Column(type="string", length=255, nullable=true)
  214.      * @Groups({"tv_company_read", "tv_company_write"})
  215.      */
  216.     private $code;
  217.     /**
  218.      * @ORM\OneToMany(targetEntity=Category::class, mappedBy="tvCompany", cascade={"persist", "refresh", "remove"})
  219.      */
  220.     private $categories;
  221.     /**
  222.      * @ORM\OneToMany(targetEntity=Channel::class, mappedBy="tvCompany", cascade={"persist", "refresh", "remove"})
  223.      */
  224.     private $channels;
  225.     /**
  226.      * @ORM\Column(type="boolean", options={"default": 0})
  227.      */
  228.     private $customizable false;
  229.     /**
  230.      * @ORM\OneToMany(targetEntity=ExclusionsChannel::class, mappedBy="tvCompany", orphanRemoval=true, cascade={"persist", "refresh", "remove"})
  231.      */
  232.     private $exclusionsChannels;
  233.     /**
  234.      * @ORM\OneToMany(targetEntity=ExclusionsCategory::class, mappedBy="tvCompany", orphanRemoval=true, cascade={"persist", "refresh", "remove"})
  235.      */
  236.     private $exclusionsCategories;
  237.     /**
  238.      * @ORM\OneToMany(targetEntity=ExclusionsVideo::class, mappedBy="tvCompany", orphanRemoval=true, cascade={"persist", "refresh", "remove"})
  239.      */
  240.     private $exclusionsVideos;
  241.     /**
  242.      * @ORM\OneToMany(targetEntity=Department::class, mappedBy="tvCompany", cascade={"persist", "refresh", "remove"})
  243.      * @Groups({"tv_user_read", "tv_company_read", "tv_user_tv_company_read"})
  244.      */
  245.     private $departments;
  246.     /**
  247.      * @ORM\Column(type="text", nullable=true)
  248.      * @Groups({"tv_user_read", "tv_company_read", "tv_company_write", "tv_user_tv_company_read"})
  249.      */
  250.     private $cms;
  251.     /**
  252.      * @ORM\Column(type="string", length=255, nullable=true)
  253.      * @Groups({"tv_user_read", "tv_company_read", "tv_company_write", "tv_user_tv_company_read"})
  254.      */
  255.     private $cmsTitle;
  256.     /**
  257.      * @ORM\ManyToOne(targetEntity=MediaObject::class)
  258.      * @Groups({"tv_user_read", "tv_company_read", "tv_company_write", "tv_user_tv_company_read"})
  259.      */
  260.     private $cmsImg;
  261.     /**
  262.      * @ORM\Column(type="text", nullable=true)
  263.      * @Groups({"tv_user_read", "tv_company_read", "tv_company_write", "tv_user_tv_company_read"})
  264.      */
  265.     private $cmsText;
  266.     /**
  267.      * @ORM\Column(type="string", length=255, nullable=true)
  268.      * @Groups({"tv_user_read", "tv_company_read", "tv_company_write", "tv_user_tv_company_read"})
  269.      */
  270.     private $cmsCtaText;
  271.     /**
  272.      * @ORM\Column(type="string", length=255, nullable=true)
  273.      * @Groups({"tv_user_read", "tv_company_read", "tv_company_write", "tv_user_tv_company_read"})
  274.      */
  275.     private $cmsCtaUrl;
  276.     /**
  277.      * @ORM\OneToMany(targetEntity=LogEmail::class, mappedBy="tvCompany", cascade={"persist", "refresh", "remove"})
  278.      */
  279.     private $logEmails;
  280.     /**
  281.      * @ORM\ManyToMany(targetEntity=Award::class, mappedBy="tvCompanies")
  282.      */
  283.     private $awards;
  284.     /**
  285.      * @ORM\ManyToMany(targetEntity=Association::class)
  286.      * @Groups({"tv_user_tv_company_read", "tv_company_read", "tv_company_write"})
  287.      */
  288.     private $associations;
  289.     /**
  290.      * @ORM\OneToMany(targetEntity=Program::class, mappedBy="tvCompany", cascade={"persist", "refresh", "remove"})
  291.      */
  292.     private $programs;
  293.     /**
  294.      * @ORM\Column(type="boolean", nullable=true)
  295.      * @Groups({"tv_user_read", "tv_company_read", "tv_company_write", "export_csv", "message_read", "tv_user_tv_company_read",
  296.      *     "tv_user_read_creation", "simple_company", "video_read", "category_read", "channel_read", "company_form",
  297.      *     "video_form_complete", "manager_dashboard", "award_read"})
  298.      */
  299.     private $resaLinkActive;
  300.     /**
  301.      * @ORM\OneToMany(targetEntity=Team::class, mappedBy="tvCompany", cascade={"persist", "refresh", "remove"})
  302.      */
  303.     private $teams;
  304.     /**
  305.      * @Groups({"tv_user_read", "tv_company_read", "tv_user_tv_company_read"})
  306.      */
  307.     private $teamplayTeams;
  308.     /**
  309.      * @ORM\OneToMany(targetEntity=Teamplay::class, mappedBy="tvCompany", cascade={"persist", "refresh", "remove"})
  310.      */
  311.     private $teamplays;
  312.     /**
  313.      * @ORM\OneToMany(targetEntity=TeamplayChallenge::class, mappedBy="tvCompany", cascade={"persist", "refresh", "remove"})
  314.      */
  315.     private $teamplayChallenges;
  316.     /**
  317.      * @ORM\OneToMany(targetEntity=TeamplayLog::class, mappedBy="tvCompany", cascade={"persist", "refresh", "remove"})
  318.      */
  319.     private $teamplayLogs;
  320.     /**
  321.      * @ORM\OneToMany(targetEntity=PedometerLog::class, mappedBy="tvCompany", cascade={"persist", "refresh", "remove"})
  322.      */
  323.     private $pedometerLogs;
  324.     /**
  325.      * @ORM\OneToMany(targetEntity=Log::class, mappedBy="tvCompany", cascade={"persist", "refresh", "remove"})
  326.      */
  327.     private $logs;
  328.     /**
  329.      * @ORM\OneToMany(targetEntity=UserNotification::class, mappedBy="tvCompany", cascade={"persist", "refresh", "remove"})
  330.      */
  331.     private $userNotifications;
  332.     
  333.     /**
  334.      * @ORM\OneToMany(targetEntity=Slide::class, mappedBy="tvCompany", orphanRemoval=true, cascade={"persist", "refresh", "remove"})
  335.      */
  336.     private $slides;
  337.     
  338.     /**
  339.      * @ORM\OneToMany(targetEntity=AwardConfig::class, mappedBy="tvCompany", orphanRemoval=true, cascade={"persist", "refresh", "remove"})
  340.      */
  341.     private $awardConfigs;
  342.     /**
  343.      * @ORM\OneToOne(targetEntity=Company::class, inversedBy="tvCompany")
  344.      */
  345.     private $company;
  346.     public function __construct()
  347.     {
  348.         $this->tvUsers = new ArrayCollection();
  349.         $this->restrictions = new ArrayCollection();
  350.         $this->orders = new ArrayCollection();
  351.         $this->updatedAt = new \DateTime();
  352.         $this->createdAt = new \DateTime();
  353.         $this->categories = new ArrayCollection();
  354.         $this->channels = new ArrayCollection();
  355.         $this->exclusionsChannels = new ArrayCollection();
  356.         $this->exclusionsCategories = new ArrayCollection();
  357.         $this->exclusionsVideos = new ArrayCollection();
  358.         $this->departments = new ArrayCollection();
  359.         $this->logEmails = new ArrayCollection();
  360.         $this->awards = new ArrayCollection();
  361.         $this->associations = new ArrayCollection();
  362.         $this->programs = new ArrayCollection();
  363.         $this->teams = new ArrayCollection();
  364.         $this->teamplays = new ArrayCollection();
  365.         $this->teamplayChallenges = new ArrayCollection();
  366.         $this->teamplayLogs = new ArrayCollection();
  367.         $this->pedometerLogs = new ArrayCollection();
  368.         $this->logs = new ArrayCollection();
  369.         $this->userNotifications = new ArrayCollection();
  370.         $this->slides = new ArrayCollection();
  371.         $this->awardConfigs = new ArrayCollection();
  372.     }
  373.     /**
  374.      * Gets the active order no more than an order can be active at a time for a tvCompany
  375.      * @return Order|null
  376.      */
  377.     public function getActiveOrder(): ?Order
  378.     {
  379.         foreach ($this->orders as $order) {
  380.             if ($order instanceof Order && $order->getActive()) {
  381.                 return $order;
  382.             }
  383.         }
  384.         return null;
  385.     }
  386.     public function getId(): ?int
  387.     {
  388.         return $this->id;
  389.     }
  390.     public function getName(): ?string
  391.     {
  392.         return $this->name;
  393.     }
  394.     public function setName(string $name): self
  395.     {
  396.         $this->name $name;
  397.         return $this;
  398.     }
  399.     public function getAddressLine(): ?string
  400.     {
  401.         return $this->addressLine;
  402.     }
  403.     public function setAddressLine(string $addressLine): self
  404.     {
  405.         $this->addressLine $addressLine;
  406.         return $this;
  407.     }
  408.     public function getCity(): ?string
  409.     {
  410.         return $this->city;
  411.     }
  412.     public function setCity(string $city): self
  413.     {
  414.         $this->city $city;
  415.         return $this;
  416.     }
  417.     public function getZipCode(): ?string
  418.     {
  419.         return $this->zipCode;
  420.     }
  421.     public function setZipCode(string $zipCode): self
  422.     {
  423.         $this->zipCode $zipCode;
  424.         return $this;
  425.     }
  426.     public function getCountry(): ?string
  427.     {
  428.         return $this->country;
  429.     }
  430.     public function setCountry(string $country): self
  431.     {
  432.         $this->country $country;
  433.         return $this;
  434.     }
  435.     public function getManagerFirstName(): ?string
  436.     {
  437.         return $this->managerFirstName;
  438.     }
  439.     public function setManagerFirstName(string $managerFirstName): self
  440.     {
  441.         $this->managerFirstName $managerFirstName;
  442.         return $this;
  443.     }
  444.     public function getManagerLastName(): ?string
  445.     {
  446.         return $this->managerLastName;
  447.     }
  448.     public function setManagerLastName(string $managerLastName): self
  449.     {
  450.         $this->managerLastName $managerLastName;
  451.         return $this;
  452.     }
  453.     public function getManagerFunction(): ?string
  454.     {
  455.         return $this->managerFunction;
  456.     }
  457.     public function setManagerFunction(string $managerFunction): self
  458.     {
  459.         $this->managerFunction $managerFunction;
  460.         return $this;
  461.     }
  462.     public function getManagerPhone(): ?string
  463.     {
  464.         return $this->managerPhone;
  465.     }
  466.     public function setManagerPhone(string $managerPhone): self
  467.     {
  468.         $this->managerPhone $managerPhone;
  469.         return $this;
  470.     }
  471.     public function getManagerEmail(): ?string
  472.     {
  473.         return $this->managerEmail;
  474.     }
  475.     public function setManagerEmail(string $managerEmail): self
  476.     {
  477.         $this->managerEmail $managerEmail;
  478.         return $this;
  479.     }
  480.     public function getSiren(): ?string
  481.     {
  482.         return $this->siren;
  483.     }
  484.     public function setSiren(string $siren): self
  485.     {
  486.         $this->siren $siren;
  487.         return $this;
  488.     }
  489.     public function getActive(): ?bool
  490.     {
  491.         return $this->active;
  492.     }
  493.     public function setActive(bool $active): self
  494.     {
  495.         $this->active $active;
  496.         return $this;
  497.     }
  498.     /**
  499.      * @return Collection|TvUser[]
  500.      */
  501.     public function getTvUsers(): Collection
  502.     {
  503.         return $this->tvUsers;
  504.     }
  505.     public function addUser(TvUser $tvUser): self
  506.     {
  507.         if (!$this->tvUsers->contains($tvUser)) {
  508.             $this->tvUsers[] = $tvUser;
  509.             $tvUser->setTvCompany($this);
  510.         }
  511.         return $this;
  512.     }
  513.     public function removeUser(TvUser $tvUser): self
  514.     {
  515.         if ($this->tvUsers->removeElement($tvUser)) {
  516.             // set the owning side to null (unless already changed)
  517.             if ($tvUser->getTvCompany() === $this) {
  518.                 $tvUser->setTvCompany(null);
  519.             }
  520.         }
  521.         return $this;
  522.     }
  523.     /**
  524.      * @return Collection|Restriction[]
  525.      */
  526.     public function getRestrictions(): Collection
  527.     {
  528.         return $this->restrictions;
  529.     }
  530.     public function addRestriction(Restriction $restriction): self
  531.     {
  532.         if (!$this->restrictions->contains($restriction)) {
  533.             $this->restrictions[] = $restriction;
  534.             $restriction->setTvCompany($this);
  535.         }
  536.         return $this;
  537.     }
  538.     public function removeRestriction(Restriction $restriction): self
  539.     {
  540.         if ($this->restrictions->removeElement($restriction)) {
  541.             // set the owning side to null (unless already changed)
  542.             if ($restriction->getTvCompany() === $this) {
  543.                 $restriction->setTvCompany(null);
  544.             }
  545.         }
  546.         return $this;
  547.     }
  548.     /**
  549.      * @return Collection|Order[]
  550.      */
  551.     public function getOrders(): Collection
  552.     {
  553.         return $this->orders;
  554.     }
  555.     public function addOrder(Order $order): self
  556.     {
  557.         if (!$this->orders->contains($order)) {
  558.             $this->orders[] = $order;
  559.             $order->setTvCompany($this);
  560.         }
  561.         return $this;
  562.     }
  563.     public function removeOrder(Order $order): self
  564.     {
  565.         if ($this->orders->removeElement($order)) {
  566.             // set the owning side to null (unless already changed)
  567.             if ($order->getTvCompany() === $this) {
  568.                 $order->setTvCompany(null);
  569.             }
  570.         }
  571.         return $this;
  572.     }
  573.     /**
  574.      * Updates the entity including users count, created at and updated at elements
  575.      * and the start and the end of the subscription
  576.      * @return TvCompany
  577.      * @ORM\PrePersist
  578.      */
  579.     public function updateEntity(): self
  580.     {
  581.         $this->updateSubscription();
  582.         $this->updateStatus();
  583.         $this->updateTvUsersCount();
  584.         $this->updatedAt = new \DateTime();
  585.         return $this;
  586.     }
  587.     /**
  588.      * Updates the count of the tvCompany users
  589.      */
  590.     private function updateTvUsersCount()
  591.     {
  592.         $this->tvUsersCount $this->tvUsers->count();
  593.     }
  594.     /**
  595.      * Updates subscription dates
  596.      */
  597.     private function updateSubscription()
  598.     {
  599.         $order $this->getActiveOrder();
  600.         if ($order instanceof Order) {
  601.             $this->subscriptionEnd $order->getEnd();
  602.             $this->subscriptionStart $order->getStart();
  603.         }
  604.     }
  605.     /**
  606.      * Updates the status of the tvCompany
  607.      */
  608.     private function updateStatus()
  609.     {
  610.         $ret self::STATUS_ACTIVE;
  611.         if ($this->subscriptionEnd < (new \DateTime())) {
  612.             $ret self::STATUS_EXPIRED;
  613.         }
  614.         if (!$this->active) {
  615.             $ret self::STATUS_SUSPENDED;
  616.         }
  617.         $this->status $ret;
  618.     }
  619.     public function getLogo(): ?MediaObject
  620.     {
  621.         return $this->logo;
  622.     }
  623.     public function setLogo(?MediaObject $logo): self
  624.     {
  625.         $this->logo $logo;
  626.         return $this;
  627.     }
  628.     /**
  629.      * @param mixed $status
  630.      * @return TvCompany
  631.      */
  632.     public function setStatus(?string $status): TvCompany
  633.     {
  634.         $this->status $status;
  635.         if (in_array($this->status, [self::STATUS_SUSPENDEDself::STATUS_EXPIREDself::STATUS_INACTIVE])) {
  636.             $this->active false;
  637.         } else {
  638.             $this->active true;
  639.         }
  640.         return $this;
  641.     }
  642.     /**
  643.      * @return string
  644.      */
  645.     public function getStatus(): string
  646.     {
  647.         return $this->status;
  648.     }
  649.     public function getCreatedAt(): ?\DateTimeInterface
  650.     {
  651.         return $this->createdAt;
  652.     }
  653.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  654.     {
  655.         $this->createdAt $createdAt;
  656.         return $this;
  657.     }
  658.     public function getUpdatedAt(): ?\DateTimeInterface
  659.     {
  660.         return $this->updatedAt;
  661.     }
  662.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  663.     {
  664.         $this->updatedAt $updatedAt;
  665.         return $this;
  666.     }
  667.     public function getSubscriptionStart(): ?\DateTimeInterface
  668.     {
  669.         return $this->subscriptionStart;
  670.     }
  671.     public function setSubscriptionStart(?\DateTimeInterface $subscriptionStart): self
  672.     {
  673.         $this->subscriptionStart $subscriptionStart;
  674.         return $this;
  675.     }
  676.     public function getSubscriptionEnd(): ?\DateTimeInterface
  677.     {
  678.         return $this->subscriptionEnd;
  679.     }
  680.     public function setSubscriptionEnd(?\DateTimeInterface $subscriptionEnd): self
  681.     {
  682.         $this->subscriptionEnd $subscriptionEnd;
  683.         return $this;
  684.     }
  685.     public function getTvUsersCount(): ?int
  686.     {
  687.         return $this->tvUsersCount;
  688.     }
  689.     public function setTvUsersCount(int $tvUsersCount): self
  690.     {
  691.         $this->tvUsersCount $tvUsersCount;
  692.         return $this;
  693.     }
  694.     public function getMessages(): ?array
  695.     {
  696.         if (!is_array($this->messages)) {
  697.             $this->messages = [];
  698.         }
  699.         return $this->messages;
  700.     }
  701.     /**
  702.      * Gets a message if it exists
  703.      * @param string $key
  704.      * @return string|null
  705.      */
  706.     public function getMessage(string $key): ?string
  707.     {
  708.         $_messages $this->getMessages();
  709.         return (!empty($_messages[$key])) ? $_messages[$key] : null;
  710.     }
  711.     public function setMessages(array $messages): self
  712.     {
  713.         $this->messages $messages;
  714.         return $this;
  715.     }
  716.     /**
  717.      * Indicates if a tvUser is restricted according to general tvCompany restrictions
  718.      *
  719.      * @param \DateTime $time
  720.      * @return bool
  721.      */
  722.     public function isRestricted(\DateTime $time): bool
  723.     {
  724.         foreach ($this->restrictions as $restriction) {
  725.             if ($restriction instanceof Restriction && $restriction->isRestricted($time)) {
  726.                 return true;
  727.             }
  728.         }
  729.         return false;
  730.     }
  731.     /**
  732.      * Gets the start of the next restriction on a given interval
  733.      * @param \DateTime $start
  734.      * @param \DateTime $end
  735.      * @return \DateTime|null
  736.      */
  737.     public function getNextRestriction(\DateTime $start\DateTime $end): ?\DateTime
  738.     {
  739.         foreach ($this->restrictions as $restriction) {
  740.             if ($restriction instanceof Restriction) {
  741.                 $startRestriction $restriction->getStart($start);
  742.                 if ($startRestriction <= $end) {
  743.                     return $startRestriction;
  744.                 }
  745.             }
  746.         }
  747.         return null;
  748.     }
  749.     /**
  750.      * Gets the end of a restriction
  751.      * @return string
  752.      */
  753.     public function getEndRestriction(\DateTime $day): string
  754.     {
  755.         foreach ($this->restrictions as $restriction) {
  756.             if (
  757.                 $restriction instanceof Restriction && $restriction->isRestricted($day)
  758.                 && $restriction->getCode() == Restriction::WEEKLY
  759.             ) {
  760.                 return $restriction->getEnd($day)->format('H:i');
  761.             }
  762.         }
  763.         return '';
  764.     }
  765.     /**
  766.      * Gets the end of a restriction
  767.      * @return string
  768.      */
  769.     public function getStartRestriction(\DateTime $day): string
  770.     {
  771.         foreach ($this->restrictions as $restriction) {
  772.             if (
  773.                 $restriction instanceof Restriction && $restriction->isRestricted($day)
  774.                 && $restriction->getCode() == Restriction::WEEKLY
  775.             ) {
  776.                 return $restriction->getStart($day)->format('H:i');
  777.             }
  778.         }
  779.         return '';
  780.     }
  781.     public function getMaxUsers(): ?int
  782.     {
  783.         return $this->maxUsers;
  784.     }
  785.     public function setMaxUsers(?int $maxUsers): self
  786.     {
  787.         $this->maxUsers $maxUsers;
  788.         return $this;
  789.     }
  790.     public function getPlan(): ?string
  791.     {
  792.         return $this->plan;
  793.     }
  794.     public function setPlan(?string $plan): self
  795.     {
  796.         $this->plan $plan;
  797.         return $this;
  798.     }
  799.     public function getSlug(): ?string
  800.     {
  801.         return $this->slug;
  802.     }
  803.     public function setSlug(string $slug): self
  804.     {
  805.         $this->slug $slug;
  806.         return $this;
  807.     }
  808.     public function getIps(): ?array
  809.     {
  810.         return $this->ips;
  811.     }
  812.     public function setIps(?array $ips): self
  813.     {
  814.         $this->ips $ips;
  815.         return $this;
  816.     }
  817.     public function getDomain(): ?array
  818.     {
  819.         return $this->domain;
  820.     }
  821.     public function setDomain(?array $domain): self
  822.     {
  823.         $this->domain $domain;
  824.         return $this;
  825.     }
  826.     public function getHourlyRestriction(): ?int
  827.     {
  828.         return $this->hourlyRestriction;
  829.     }
  830.     public function setHourlyRestriction($hourlyRestriction): self
  831.     {
  832.         if (is_bool($hourlyRestriction)) {
  833.             if ($hourlyRestriction) {
  834.                 $hourlyRestriction 5;
  835.             } else {
  836.                 $hourlyRestriction 0;
  837.             }
  838.         }
  839.         $this->hourlyRestriction $hourlyRestriction;
  840.         return $this;
  841.     }
  842.     public function getCode(): ?string
  843.     {
  844.         return $this->code;
  845.     }
  846.     public function setCode(?string $code): self
  847.     {
  848.         $this->code $code;
  849.         return $this;
  850.     }
  851.     /**
  852.      * @return Collection|Category[]
  853.      */
  854.     public function getCategories(): Collection
  855.     {
  856.         return $this->categories;
  857.     }
  858.     public function addCategory(Category $category): self
  859.     {
  860.         if (!$this->categories->contains($category)) {
  861.             $this->categories[] = $category;
  862.             $category->setTvCompany($this);
  863.         }
  864.         return $this;
  865.     }
  866.     public function removeCategory(Category $category): self
  867.     {
  868.         if ($this->categories->removeElement($category)) {
  869.             // set the owning side to null (unless already changed)
  870.             if ($category->getTvCompany() === $this) {
  871.                 $category->setTvCompany(null);
  872.             }
  873.         }
  874.         return $this;
  875.     }
  876.     /**
  877.      * @return Collection|Channel[]
  878.      */
  879.     public function getChannels(): Collection
  880.     {
  881.         return $this->channels;
  882.     }
  883.     public function addChannel(Channel $channel): self
  884.     {
  885.         if (!$this->channels->contains($channel)) {
  886.             $this->channels[] = $channel;
  887.             $channel->setTvCompany($this);
  888.         }
  889.         return $this;
  890.     }
  891.     public function removeChannel(Channel $channel): self
  892.     {
  893.         if ($this->channels->removeElement($channel)) {
  894.             // set the owning side to null (unless already changed)
  895.             if ($channel->getTvCompany() === $this) {
  896.                 $channel->setTvCompany(null);
  897.             }
  898.         }
  899.         return $this;
  900.     }
  901.     public function getCustomizable(): ?bool
  902.     {
  903.         return $this->customizable;
  904.     }
  905.     public function isCustomizable(): bool
  906.     {
  907.         return boolval($this->customizable);
  908.     }
  909.     public function setCustomizable(bool $customizable): self
  910.     {
  911.         $this->customizable $customizable;
  912.         return $this;
  913.     }
  914.     /**
  915.      * @return string
  916.      * @Groups({"tv_company_read"})
  917.      */
  918.     public function getUrl(): string
  919.     {
  920.         return $this->getSlug() . 'ulteamtv.fr';
  921.     }
  922.     public function __toString(): string
  923.     {
  924.         return "TvCompany #{$this->getId()}#: {$this->getName()}";
  925.     }
  926.     /**
  927.      * @return Collection|Department[]
  928.      */
  929.     public function getDepartments(): Collection
  930.     {
  931.         return $this->departments;
  932.     }
  933.     public function addDepartment(Department $department): self
  934.     {
  935.         if (!$this->departments->contains($department)) {
  936.             $this->departments[] = $department;
  937.             $department->setTvCompany($this);
  938.         }
  939.         return $this;
  940.     }
  941.     public function removeDepartment(Department $department): self
  942.     {
  943.         if ($this->departments->removeElement($department)) {
  944.             // set the owning side to null (unless already changed)
  945.             if ($department->getTvCompany() === $this) {
  946.                 $department->setTvCompany(null);
  947.             }
  948.         }
  949.         return $this;
  950.     }
  951.     public function getCms(): ?string
  952.     {
  953.         return $this->cms;
  954.     }
  955.     public function setCms(?string $cms): self
  956.     {
  957.         $this->cms $cms;
  958.         return $this;
  959.     }
  960.     public function getCmsTitle(): ?string
  961.     {
  962.         return $this->cmsTitle;
  963.     }
  964.     public function setCmsTitle(?string $cmsTitle): self
  965.     {
  966.         $this->cmsTitle $cmsTitle;
  967.         return $this;
  968.     }
  969.     public function getCmsImg(): ?MediaObject
  970.     {
  971.         return $this->cmsImg;
  972.     }
  973.     public function setCmsImg(?MediaObject $cmsImg): self
  974.     {
  975.         $this->cmsImg $cmsImg;
  976.         return $this;
  977.     }
  978.     public function getCmsText(): ?string
  979.     {
  980.         return $this->cmsText;
  981.     }
  982.     public function setCmsText(?string $cmsText): self
  983.     {
  984.         $this->cmsText $cmsText;
  985.         return $this;
  986.     }
  987.     public function getCmsCtaText(): ?string
  988.     {
  989.         return $this->cmsCtaText;
  990.     }
  991.     public function setCmsCtaText(?string $cmsCtaText): self
  992.     {
  993.         $this->cmsCtaText $cmsCtaText;
  994.         return $this;
  995.     }
  996.     public function getCmsCtaUrl(): ?string
  997.     {
  998.         return $this->cmsCtaUrl;
  999.     }
  1000.     public function setCmsCtaUrl(?string $cmsCtaUrl): self
  1001.     {
  1002.         $this->cmsCtaUrl $cmsCtaUrl;
  1003.         return $this;
  1004.     }
  1005.     /**
  1006.      * @return Collection|ExclusionsChannel[]
  1007.      */
  1008.     public function getExclusionsChannels(): Collection
  1009.     {
  1010.         return $this->exclusionsChannels;
  1011.     }
  1012.     public function addExclusionsChannel(ExclusionsChannel $exclusionsChannel): self
  1013.     {
  1014.         if (!$this->exclusionsChannels->contains($exclusionsChannel)) {
  1015.             $this->exclusionsChannels[] = $exclusionsChannel;
  1016.             $exclusionsChannel->setTvCompany($this);
  1017.         }
  1018.         return $this;
  1019.     }
  1020.     public function removeExclusionsChannel(ExclusionsChannel $exclusionsChannel): self
  1021.     {
  1022.         if ($this->exclusionsChannels->removeElement($exclusionsChannel)) {
  1023.             // set the owning side to null (unless already changed)
  1024.             if ($exclusionsChannel->getTvCompany() === $this) {
  1025.                 $exclusionsChannel->setTvCompany(null);
  1026.             }
  1027.         }
  1028.         return $this;
  1029.     }
  1030.     /**
  1031.      * @return Collection|ExclusionsCategory[]
  1032.      */
  1033.     public function getExclusionsCategories(): Collection
  1034.     {
  1035.         return $this->exclusionsCategories;
  1036.     }
  1037.     public function addExclusionsCategory(ExclusionsCategory $exclusionsCategory): self
  1038.     {
  1039.         if (!$this->exclusionsCategories->contains($exclusionsCategory)) {
  1040.             $this->exclusionsCategories[] = $exclusionsCategory;
  1041.             $exclusionsCategory->setTvCompany($this);
  1042.         }
  1043.         return $this;
  1044.     }
  1045.     public function removeExclusionsCategory(ExclusionsCategory $exclusionsCategory): self
  1046.     {
  1047.         if ($this->exclusionsCategories->removeElement($exclusionsCategory)) {
  1048.             // set the owning side to null (unless already changed)
  1049.             if ($exclusionsCategory->getTvCompany() === $this) {
  1050.                 $exclusionsCategory->setTvCompany(null);
  1051.             }
  1052.         }
  1053.         return $this;
  1054.     }
  1055.     /**
  1056.      * @return Collection|ExclusionsVideo[]
  1057.      */
  1058.     public function getExclusionsVideos(): Collection
  1059.     {
  1060.         return $this->exclusionsVideos;
  1061.     }
  1062.     public function addExclusionsVideo(ExclusionsVideo $exclusionsVideo): self
  1063.     {
  1064.         if (!$this->exclusionsVideos->contains($exclusionsVideo)) {
  1065.             $this->exclusionsVideos[] = $exclusionsVideo;
  1066.             $exclusionsVideo->setTvCompany($this);
  1067.         }
  1068.         return $this;
  1069.     }
  1070.     public function removeExclusionsVideo(ExclusionsVideo $exclusionsVideo): self
  1071.     {
  1072.         if ($this->exclusionsVideos->removeElement($exclusionsVideo)) {
  1073.             // set the owning side to null (unless already changed)
  1074.             if ($exclusionsVideo->getTvCompany() === $this) {
  1075.                 $exclusionsVideo->setTvCompany(null);
  1076.             }
  1077.         }
  1078.         return $this;
  1079.     }
  1080.     public function checkSubscriptionsDates(\DateTime $today)
  1081.     {
  1082.         return $today >= $this->subscriptionStart && $today <= $this->getSubscriptionEnd();
  1083.     }
  1084.     /**
  1085.      * @return Collection|LogEmail[]
  1086.      */
  1087.     public function getLogEmails(): Collection
  1088.     {
  1089.         return $this->logEmails;
  1090.     }
  1091.     public function addLogEmail(LogEmail $logEmail): self
  1092.     {
  1093.         if (!$this->logEmails->contains($logEmail)) {
  1094.             $this->logEmails[] = $logEmail;
  1095.             $logEmail->setTvCompany($this);
  1096.         }
  1097.         return $this;
  1098.     }
  1099.     public function removeLogEmail(LogEmail $logEmail): self
  1100.     {
  1101.         if ($this->logEmails->removeElement($logEmail)) {
  1102.             // set the owning side to null (unless already changed)
  1103.             if ($logEmail->getTvCompany() === $this) {
  1104.                 $logEmail->setTvCompany(null);
  1105.             }
  1106.         }
  1107.         return $this;
  1108.     }
  1109.     /**
  1110.      * @return Collection|Award[]
  1111.      */
  1112.     public function getAwards(): Collection
  1113.     {
  1114.         return $this->awards;
  1115.     }
  1116.     public function addAward(Award $award): self
  1117.     {
  1118.         if (!$this->awards->contains($award)) {
  1119.             $this->awards[] = $award;
  1120.             $award->addTvCompany($this);
  1121.         }
  1122.         return $this;
  1123.     }
  1124.     public function removeAward(Award $award): self
  1125.     {
  1126.         if ($this->awards->removeElement($award)) {
  1127.             $award->removeTvCompany($this);
  1128.         }
  1129.         return $this;
  1130.     }
  1131.     /**
  1132.      * @Groups({"tv_company_read"})
  1133.      */
  1134.     public function getActiveAward()
  1135.     {
  1136.         $award null;
  1137.         $today = (new \DateTime("now"))->setTime(000);
  1138.         foreach ($this->awards->toArray() as $value) {
  1139.             if ($value->getActive() && $value->getDateStart() <= $today  && $value->getDateEnd() >= $today) {
  1140.                 $award $value;
  1141.             }
  1142.         }
  1143.         return $award;
  1144.     }
  1145.     /**
  1146.      * @return Collection|Association[]
  1147.      */
  1148.     public function getAssociations(): Collection
  1149.     {
  1150.         return $this->associations;
  1151.     }
  1152.     public function addAssociation(Association $association): self
  1153.     {
  1154.         if (!$this->associations->contains($association)) {
  1155.             $this->associations[] = $association;
  1156.         }
  1157.         return $this;
  1158.     }
  1159.     public function removeAssociation(Association $association): self
  1160.     {
  1161.         $this->associations->removeElement($association);
  1162.         return $this;
  1163.     }
  1164.     /**
  1165.      * @return Collection|Program[]
  1166.      */
  1167.     public function getPrograms(): Collection
  1168.     {
  1169.         return $this->programs;
  1170.     }
  1171.     public function addProgram(Program $program): self
  1172.     {
  1173.         if (!$this->programs->contains($program)) {
  1174.             $this->programs[] = $program;
  1175.             $program->setTvCompany($this);
  1176.         }
  1177.         return $this;
  1178.     }
  1179.     public function removeProgram(Program $program): self
  1180.     {
  1181.         if ($this->programs->removeElement($program)) {
  1182.             // set the owning side to null (unless already changed)
  1183.             if ($program->getTvCompany() === $this) {
  1184.                 $program->setTvCompany(null);
  1185.             }
  1186.         }
  1187.         return $this;
  1188.     }
  1189.     public function getResaLinkActive(): ?bool
  1190.     {
  1191.         return $this->resaLinkActive;
  1192.     }
  1193.     public function setResaLinkActive(?bool $resaLinkActive): self
  1194.     {
  1195.         $this->resaLinkActive $resaLinkActive;
  1196.         return $this;
  1197.     }
  1198.     /**
  1199.      * @return Collection|Team[]
  1200.      */
  1201.     public function getTeams(): Collection
  1202.     {
  1203.         return $this->teams;
  1204.     }
  1205.     public function addTeam(Team $team): self
  1206.     {
  1207.         if (!$this->teams->contains($team)) {
  1208.             $this->teams[] = $team;
  1209.             $team->setTvCompany($this);
  1210.         }
  1211.         return $this;
  1212.     }
  1213.     public function removeTeam(Team $team): self
  1214.     {
  1215.         if ($this->teams->removeElement($team)) {
  1216.             // set the owning side to null (unless already changed)
  1217.             if ($team->getTvCompany() === $this) {
  1218.                 $team->setTvCompany(null);
  1219.             }
  1220.         }
  1221.         return $this;
  1222.     }
  1223.     /**
  1224.      * Récupère un array de team de type = "teamplay"
  1225.      * @return Team[]|null
  1226.      */
  1227.     public function getTeamplayTeams(): ?array
  1228.     {
  1229.         $teamplayTeams null;
  1230.         if (!empty($this->teams->toArray())) {
  1231.             $teamplayTeams = [];
  1232.             foreach ($this->teams->toArray() as $team) {
  1233.                 if ($team->isTeamplay()) $teamplayTeams[] = $team;
  1234.             }
  1235.         }
  1236.         return $teamplayTeams;
  1237.     }
  1238.     /**
  1239.      * @return Collection|Teamplay[]
  1240.      */
  1241.     public function getTeamplays(): Collection
  1242.     {
  1243.         return $this->teamplays;
  1244.     }
  1245.     public function addTeamplay(Teamplay $teamplay): self
  1246.     {
  1247.         if (!$this->teamplays->contains($teamplay)) {
  1248.             $this->teamplays[] = $teamplay;
  1249.             $teamplay->setTvCompany($this);
  1250.         }
  1251.         return $this;
  1252.     }
  1253.     public function removeTeamplay(Teamplay $teamplay): self
  1254.     {
  1255.         if ($this->teamplays->removeElement($teamplay)) {
  1256.             // set the owning side to null (unless already changed)
  1257.             if ($teamplay->getTvCompany() === $this) {
  1258.                 $teamplay->setTvCompany(null);
  1259.             }
  1260.         }
  1261.         return $this;
  1262.     }
  1263.     /**
  1264.      * @return Collection|TeamplayChallenge[]
  1265.      */
  1266.     public function getTeamplayChallenges(): Collection
  1267.     {
  1268.         return $this->teamplayChallenges;
  1269.     }
  1270.     public function addTeamplayChallenge(TeamplayChallenge $teamplayChallenge): self
  1271.     {
  1272.         if (!$this->teamplayChallenges->contains($teamplayChallenge)) {
  1273.             $this->teamplayChallenges[] = $teamplayChallenge;
  1274.             $teamplayChallenge->setTvCompany($this);
  1275.         }
  1276.         return $this;
  1277.     }
  1278.     public function removeTeamplayChallenge(TeamplayChallenge $teamplayChallenge): self
  1279.     {
  1280.         if ($this->teamplayChallenges->removeElement($teamplayChallenge)) {
  1281.             // set the owning side to null (unless already changed)
  1282.             if ($teamplayChallenge->getTvCompany() === $this) {
  1283.                 $teamplayChallenge->setTvCompany(null);
  1284.             }
  1285.         }
  1286.         return $this;
  1287.     }
  1288.     /**
  1289.      * @return Collection|TeamplayLog[]
  1290.      */
  1291.     public function getTeamplayLogs(): Collection
  1292.     {
  1293.         return $this->teamplayLogs;
  1294.     }
  1295.     public function addTeamplayLog(TeamplayLog $teamplayLog): self
  1296.     {
  1297.         if (!$this->teamplayLogs->contains($teamplayLog)) {
  1298.             $this->teamplayLogs[] = $teamplayLog;
  1299.             $teamplayLog->setTvCompany($this);
  1300.         }
  1301.         return $this;
  1302.     }
  1303.     public function removeTeamplayLog(TeamplayLog $teamplayLog): self
  1304.     {
  1305.         if ($this->teamplayLogs->removeElement($teamplayLog)) {
  1306.             // set the owning side to null (unless already changed)
  1307.             if ($teamplayLog->getTvCompany() === $this) {
  1308.                 $teamplayLog->setTvCompany(null);
  1309.             }
  1310.         }
  1311.         return $this;
  1312.     }
  1313.     /**
  1314.      * @return Collection|PedometerLog[]
  1315.      */
  1316.     public function getPedometerLogs(): Collection
  1317.     {
  1318.         return $this->pedometerLogs;
  1319.     }
  1320.     public function addPedometerLog(PedometerLog $pedometerLog): self
  1321.     {
  1322.         if (!$this->pedometerLogs->contains($pedometerLog)) {
  1323.             $this->pedometerLogs[] = $pedometerLog;
  1324.             $pedometerLog->setTvCompany($this);
  1325.         }
  1326.         return $this;
  1327.     }
  1328.     public function removePedometerLog(PedometerLog $pedometerLog): self
  1329.     {
  1330.         if ($this->pedometerLogs->removeElement($pedometerLog)) {
  1331.             // set the owning side to null (unless already changed)
  1332.             if ($pedometerLog->getTvCompany() === $this) {
  1333.                 $pedometerLog->setTvCompany(null);
  1334.             }
  1335.         }
  1336.         return $this;
  1337.     }
  1338.     /**
  1339.      * @return Collection|Log[]
  1340.      */
  1341.     public function getLogs(): Collection
  1342.     {
  1343.         return $this->logs;
  1344.     }
  1345.     public function addLog(Log $log): self
  1346.     {
  1347.         if (!$this->logs->contains($log)) {
  1348.             $this->logs[] = $log;
  1349.             $log->setTvCompany($this);
  1350.         }
  1351.         return $this;
  1352.     }
  1353.     public function removeLog(Log $log): self
  1354.     {
  1355.         if ($this->logs->removeElement($log)) {
  1356.             // set the owning side to null (unless already changed)
  1357.             if ($log->getTvCompany() === $this) {
  1358.                 $log->setTvCompany(null);
  1359.             }
  1360.         }
  1361.         return $this;
  1362.     }
  1363.     /**
  1364.      * @return Collection<int, UserNotification>
  1365.      */
  1366.     public function getUserNotifications(): Collection
  1367.     {
  1368.         return $this->userNotifications;
  1369.     }
  1370.     public function addUserNotification(UserNotification $userNotification): self
  1371.     {
  1372.         if (!$this->userNotifications->contains($userNotification)) {
  1373.             $this->userNotifications[] = $userNotification;
  1374.             $userNotification->setTvCompany($this);
  1375.         }
  1376.         return $this;
  1377.     }
  1378.     public function removeUserNotification(UserNotification $userNotification): self
  1379.     {
  1380.         if ($this->userNotifications->removeElement($userNotification)) {
  1381.             // set the owning side to null (unless already changed)
  1382.             if ($userNotification->getTvCompany() === $this) {
  1383.                 $userNotification->setTvCompany(null);
  1384.             }
  1385.         }
  1386.         return $this;
  1387.     }
  1388.     /**
  1389.      * @return Collection<int, Slide>
  1390.      */
  1391.     public function getSlides(): Collection
  1392.     {
  1393.         return $this->slides;
  1394.     }
  1395.     public function addSlide(Slide $slide): self
  1396.     {
  1397.         if (!$this->slides->contains($slide)) {
  1398.             $this->slides[] = $slide;
  1399.             $slide->setTvCompany($this);
  1400.         }
  1401.         return $this;
  1402.     }
  1403.     public function removeSlide(Slide $slide): self
  1404.     {
  1405.         if ($this->slides->removeElement($slide)) {
  1406.             // set the owning side to null (unless already changed)
  1407.             if ($slide->getTvCompany() === $this) {
  1408.                 $slide->setTvCompany(null);
  1409.             }
  1410.         }
  1411.         return $this;
  1412.     }
  1413.     /**
  1414.      * @return Collection<int, AwardConfig>
  1415.      */
  1416.     public function getAwardConfigs(): Collection
  1417.     {
  1418.         return $this->awardConfigs;
  1419.     }
  1420.     public function addAwardConfig(AwardConfig $awardConfig): self
  1421.     {
  1422.         if (!$this->awardConfigs->contains($awardConfig)) {
  1423.             $this->awardConfigs[] = $awardConfig;
  1424.             $awardConfig->setTvCompany($this);
  1425.         }
  1426.         return $this;
  1427.     }
  1428.     public function removeAwardConfig(AwardConfig $awardConfig): self
  1429.     {
  1430.         if ($this->awardConfigs->removeElement($awardConfig)) {
  1431.             // set the owning side to null (unless already changed)
  1432.             if ($awardConfig->getTvCompany() === $this) {
  1433.                 $awardConfig->setTvCompany(null);
  1434.             }
  1435.         }
  1436.         return $this;
  1437.     }
  1438.     public function getCompany(): ?Company
  1439.     {
  1440.         return $this->company;
  1441.     }
  1442.     public function setCompany(?Company $company): self
  1443.     {
  1444.         $this->company $company;
  1445.         return $this;
  1446.     }
  1447. }