src/Entity/Container.php line 143

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Annotation\EsUploadable;
  4. use App\Entity\Model\Navigation;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Controller\ContainerClone;
  7. use App\Entity\Model\Configuration;
  8. use App\Entity\Model\UserStaticField;
  9. use App\Entity\Model\ConfigurationType;
  10. use App\Repository\ContainerRepository;
  11. use App\Entity\Model\DesignConfiguration;
  12. use ApiPlatform\Core\Annotation\ApiFilter;
  13. use App\Entity\Traits\TimestampableEntity;
  14. use Doctrine\Common\Collections\Collection;
  15. use ApiPlatform\Core\Annotation\ApiProperty;
  16. use ApiPlatform\Core\Annotation\ApiResource;
  17. use App\Entity\Model\DesignConfigurationType;
  18. use App\Validator\Constraints as CustomAssert;
  19. use App\Entity\Interfaces\ClientMappedInterface;
  20. use App\Entity\Interfaces\UploadMappedInterface;
  21. use Doctrine\Common\Collections\ArrayCollection;
  22. use Symfony\Component\Serializer\Annotation\Groups;
  23. use Symfony\Component\Validator\Constraints as Assert;
  24. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  25. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  26. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
  27. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  28. /**
  29.  * @ApiResource(
  30.  *      normalizationContext={"groups"={"Container:Read"}, "skip_null_values"=false},
  31.  *      denormalizationContext={"groups"={"Container:Write"}},
  32.  *      collectionOperations={
  33.  *          "post"={"security"="is_granted('ROLE_ADMIN')"},
  34.  *          "post_clone"={
  35.  *              "route_name"="api_containers_clone_collection",
  36.  *              "method"="POST",
  37.  *              "denormalization_context"={"groups"={"Container:Clone"}},
  38.  *              "security"="is_granted('ROLE_ADMIN')"
  39.  *          },
  40.  *          "post_gen_style_request"={
  41.  *              "route_name"="api_containers_gen_style_request_collection",
  42.  *              "method"="POST",
  43.  *              "denormalization_context"={"groups"={"Container:GenStyle"}},
  44.  *              "security"="is_granted('ROLE_OPERATOR')"
  45.  *          },
  46.  *          "post_gen_translation_request"={
  47.  *              "route_name"="api_containers_gen_translation_request_collection",
  48.  *              "method"="POST",
  49.  *              "denormalization_context"={"groups"={"Container:GenTranslation"}},
  50.  *              "security"="is_granted('ROLE_OPERATOR')"
  51.  *          },
  52.  *          "post_publish_navigation_request"={
  53.  *              "route_name"="api_containers_publish_navigation_request_collection",
  54.  *              "method"="POST",
  55.  *              "denormalization_context"={"groups"={"Container:PublishNavigation"}},
  56.  *              "security"="is_granted('ROLE_OPERATOR')"
  57.  *          },
  58.  *          "post_reset_email_template"={
  59.  *              "route_name"="api_containers_reset_email_template_collection",
  60.  *              "method"="POST",
  61.  *              "security"="is_granted('ROLE_ADMIN')"
  62.  *          },
  63.  *          "post_reset_email_template_ac"={
  64.  *              "route_name"="api_containers_reset_email_template_ac_collection",
  65.  *              "method"="POST",
  66.  *              "security"="is_granted('ROLE_SUPER_ADMIN')"
  67.  *          },
  68.  *          "post_reset_email_template_acc"={
  69.  *              "route_name"="api_containers_reset_email_template_acc_collection",
  70.  *              "method"="POST",
  71.  *              "security"="is_granted('ROLE_SUPER_ADMIN')"
  72.  *          },
  73.  *          "post_add_newsfeed_sharing"={
  74.  *              "route_name"="api_containers_add_newsfeed_sharing_collection",
  75.  *              "method"="POST",
  76.  *              "security"="is_granted('ROLE_SUPER_ADMIN')"
  77.  *          },
  78.  *          "get"={
  79.  *              "security"="is_granted('ROLE_ADMIN')",
  80.  *              "normalization_context"={"groups"={"Container:Read-List"}, "skip_null_values"=false},
  81.  *              "pagination_enabled"=false
  82.  *          },
  83.  *          "get_overview"={
  84.  *              "path"="/containers/overview",
  85.  *              "method"="GET",
  86.  *              "normalization_context"={"groups"={"Container:Overview"}, "skip_null_values"=false},
  87.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')"
  88.  *          },
  89.  *          "get_my_container"={
  90.  *              "route_name"="api_containers_my_container_collection",
  91.  *              "method"="GET",
  92.  *              "normalization_context"={"groups"={"Container:Read", "Container:MyContainer"}, "skip_null_values"=false}
  93.  *          },
  94.  *          "get_for_public_page"={
  95.  *              "route_name"="api_pub_containers_get_for_public_page_collection",
  96.  *              "method"="GET",
  97.  *              "security"="is_granted('PUBLIC_ACCESS')",
  98.  *              "normalization_context"={"groups"={"Container:PRead"}, "skip_null_values"=false},
  99.  *              "pagination_enabled"=true
  100.  *          },
  101.  *      },
  102.  *      itemOperations={
  103.  *          "get"={"security"="is_granted('IS_AUTHENTICATED_FULLY', object)"},
  104.  *          "get_secure"={
  105.  *              "path"="/containers/{id}/secure",
  106.  *              "method"="GET",
  107.  *              "security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_ADMIN')",
  108.  *              "normalization_context"={"groups"={"Container:Read", "Container:ReadSecure"}, "skip_null_values"=false}
  109.  *          },
  110.  *          "put"={"security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_ADMIN')"},
  111.  *          "patch"={"security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_OPERATOR')"},
  112.  *          "patch_set_user_fields"={
  113.  *              "route_name"="api_containers_set_user_fields_collection",
  114.  *              "method"="PATCH",
  115.  *              "denormalization_context"={"groups"={"Container:SetUserFields"}},
  116.  *              "security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_OPERATOR')"
  117.  *          },
  118.  *          "patch_set_main_container"={
  119.  *              "route_name"="api_containers_set_main_container_collection",
  120.  *              "method"="PATCH",
  121.  *              "denormalization_context"={"groups"={"Container:SetMainContainer"}},
  122.  *              "security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_OPERATOR')"
  123.  *          },
  124.  *          "patch_set_login_container"={
  125.  *              "route_name"="api_containers_set_login_container_collection",
  126.  *              "method"="PATCH",
  127.  *              "denormalization_context"={"groups"={"Container:SetLoginContainer"}},
  128.  *              "security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_OPERATOR')"
  129.  *          },
  130.  *          "delete"={"security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_ADMIN')"}
  131.  *      }
  132.  * )
  133.  * @ApiFilter(SearchFilter::class, properties={"client.id": "exact", "userGroups.id", "exact", "sharingContainers.id": "exact", "domain": "partial", "name": "partial", "containerCategory.id": "exact"})
  134.  * @ApiFilter(BooleanFilter::class, properties={"isActive", "isNewsfeedSharingEnable", "isLoginContainer"})
  135.  * @ApiFilter(OrderFilter::class, properties={"id", "name": "ASC", "domain"})
  136.  * @ORM\Entity(repositoryClass=ContainerRepository::class)
  137.  * @UniqueEntity(fields={"domain"})
  138.  * @ORM\Table(name="container",indexes={@ORM\Index(name="container_domain_idx", columns={"domain"})})
  139.  */
  140. class Container implements ClientMappedInterfaceUploadMappedInterface
  141. {
  142.     /**
  143.      * Hook timestampable behavior
  144.      * updates createdAt, updatedAt fields
  145.      */
  146.     use TimestampableEntity;
  147.     /**
  148.      * @ORM\Id
  149.      * @ORM\GeneratedValue
  150.      * @ORM\Column(type="integer")
  151.      * @Groups({"Container:Read", "Container:Read-List", "Container:Overview", "Container:Storage", "Client:Read", "Container:PRead", "Conference:PRead", "Session:PRead", "ElCourse:PRead", "VideoGallery:PRead", "Client:MyClient", "User:Get-RoleContainer", "RoleContainer:Read", "Certificate:Read", "Company:Read"})
  152.      */
  153.     private $id;
  154.     /**
  155.      * @ORM\Column(type="string", length=128, unique=true)
  156.      * @Groups({"Container:Clone", "Container:Read", "Container:Read-List", "Container:Write", "Container:Storage", "Container:Overview", "Client:Read", "Container:PRead", "Conference:PRead", "Session:PRead", "ElCourse:PRead", "VideoGallery:PRead", "Client:MyClient", "User:Get-RoleContainer", "RoleContainer:Read", "JobQueue:Read", "Certificate:Read", "Company:Read"})
  157.      *
  158.      * @Assert\NotBlank(message="validation.container:domain.notBlank")
  159.      * @Assert\Length(max=128, maxMessage="validation.container:domain.max")
  160.      */
  161.     private $domain;
  162.     /**
  163.      * @ORM\Column(type="string", length=255)
  164.      * @Groups({"Container:Clone", "Container:Read", "Container:Read-List", "Container:Write", "Container:Storage", "Container:Overview", "Container:PRead", "Conference:PRead", "ElCourse:PRead", "Client:MyClient", "User:Get-RoleContainer", "RoleContainer:Read", "Certificate:Read", "Company:Read"})
  165.      *
  166.      * @Assert\NotBlank(message="validation.container:name.notBlank")
  167.      * @Assert\Length(max=255, maxMessage="validation.container:name.max")
  168.      */
  169.     private $name;
  170.     /**
  171.      * @ORM\Column(type="string", length=32, nullable=true)
  172.      * @Groups({"Container:Read", "Container:Write"})
  173.      *
  174.      * @Assert\Length(max=32, maxMessage="validation.container:containerGroup.max")
  175.      */
  176.     private $containerGroup;
  177.     /**
  178.      * @ORM\Column(type="string", length=16)
  179.      * @ApiProperty(
  180.      *     attributes={
  181.      *         "openapi_context"={
  182.      *             "type"="string",
  183.      *             "enum"={self::STORAGE_LOCAL, self::STORAGE_S3}
  184.      *         }
  185.      *     }
  186.      * )
  187.      * @Groups({"Container:Clone", "Container:Read", "Container:Read-List", "Container:Write", "Container:Storage", "Container:PRead", "Conference:PRead", "Session:PRead", "ElCourse:PRead", "VideoGallery:PRead", "Client:MyClient"})
  188.      *
  189.      * @Assert\NotBlank(message="validation.container:storage.notBlank")
  190.      * @Assert\Choice({self::STORAGE_LOCAL, self::STORAGE_S3})
  191.      */
  192.     private $storage;
  193.     public const STORAGE_LOCAL "Local";
  194.     public const STORAGE_S3 "S3";
  195.     /**
  196.      * @ORM\Column(type="string", length=255, nullable=true)
  197.      * @Groups({"Container:Clone", "Container:ReadSecure", "Container:Write"})
  198.      *
  199.      * @Assert\Length(max=255, maxMessage="validation.container:bucketKey.max")
  200.      * @CustomAssert\CheckPropertyValues(field = "getStorage", constant ={self::STORAGE_S3}, constraints = {
  201.      *      @Assert\NotBlank(message="validation.container:bucketKey.notBlank")
  202.      * })
  203.      */
  204.     private $bucketKey;
  205.     /**
  206.      * @ORM\Column(type="string", length=255, nullable=true)
  207.      * @Groups({"Container:Clone", "Container:ReadSecure", "Container:Write"})
  208.      *
  209.      * @Assert\Length(max=255, maxMessage="validation.container:bucketSecret.max")
  210.      * @CustomAssert\CheckPropertyValues(field = "getStorage", constant ={self::STORAGE_S3}, constraints = {
  211.      *      @Assert\NotBlank(message="validation.container:bucketSecret.notBlank")
  212.      * })
  213.      */
  214.     private $bucketSecret;
  215.     /**
  216.      * @ORM\Column(type="string", length=255, nullable=true)
  217.      * @Groups({"Container:Clone", "Container:Read", "Container:Write", "Container:Storage", "Container:PRead", "Conference:PRead", "Session:PRead", "ElCourse:PRead", "VideoGallery:PRead", "Client:MyClient"})
  218.      *
  219.      * @Assert\Length(max=255, maxMessage="validation.container:bucketName.max")
  220.      * @CustomAssert\CheckPropertyValues(field = "getStorage", constant ={self::STORAGE_S3}, constraints = {
  221.      *      @Assert\NotBlank(message="validation.container:bucketName.notBlank")
  222.      * })
  223.      */
  224.     private $bucketName;
  225.     /**
  226.      * @ORM\Column(type="string", length=64, nullable=true)
  227.      * @Groups({"Container:Clone", "Container:Read", "Container:Write", "Container:Storage", "Container:PRead", "Conference:PRead", "Session:PRead", "ElCourse:PRead", "VideoGallery:PRead", "Client:MyClient"})
  228.      *
  229.      * @Assert\Length(max=64, maxMessage="validation.container:bucketRegion.max")
  230.      * @CustomAssert\CheckPropertyValues(field = "getStorage", constant ={self::STORAGE_S3}, constraints = {
  231.      *      @Assert\NotBlank(message="validation.container:bucketRegion.notBlank")
  232.      * })
  233.      */
  234.     private $bucketRegion;
  235.     /**
  236.      * @ORM\Column(type="string", length=255, nullable=true)
  237.      * @Groups({"Container:Clone", "Container:Read", "Container:Write", "Container:Storage", "Container:PRead", "Conference:PRead", "Session:PRead", "ElCourse:PRead", "VideoGallery:PRead", "Client:MyClient"})
  238.      *
  239.      * @Assert\Length(max=255, maxMessage="validation.container:bucketEndpoint.max")
  240.      */
  241.     private $bucketEndpoint;
  242.     /**
  243.      * @ORM\Column(type="boolean", nullable=true)
  244.      * @Groups({"Container:Read", "Container:Read-List", "Container:Write", "User:Get-RoleContainer", "RoleContainer:Read"})
  245.      *
  246.      * @Assert\Type(type="bool", message="validation.container:isActive.typeBool")
  247.      */
  248.     private $isActive;
  249.     /**
  250.      * @ORM\ManyToOne(targetEntity=Client::class, inversedBy="containers")
  251.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  252.      * @Groups({"Container:Read", "Container:Write", "Container:PRead"})
  253.      */
  254.     private $client;
  255.     /**
  256.      * @ORM\Column(type="json", nullable=true)
  257.      * @Groups({"Container:Read", "Container:Write", "Container:Exp", "Container:Imp", "Client:MyClient"})
  258.      *
  259.      * @Assert\Type(type="array", message="validation.container:configuration.type")
  260.      */
  261.     public $configuration = [];
  262.     /**
  263.      * @Groups({"Container:Clone", "Container:GenStyle", "Container:GenTranslation", "Container:PublishNavigation"})
  264.      */
  265.     private int $cloneId;
  266.     /**
  267.      * @ORM\ManyToMany(targetEntity=UserGroup::class, inversedBy="containers")
  268.      * @Groups({"Container:Read", "Container:Write"})
  269.      */
  270.     private $userGroups;
  271.     /**
  272.      * @ORM\Column(type="array", nullable=true)
  273.      * @Groups({"Container:Read", "Container:Write", "Container:Exp", "Container:Imp", "Client:MyClient"})
  274.      */
  275.     private $designConfiguration = [];
  276.     /**
  277.      * @ORM\Column(type="text", nullable=true)
  278.      * @Groups({"Container:Read", "Container:Write", "Container:Overview", "Container:PRead", "Conference:PRead", "ElCourse:PRead"})
  279.      */
  280.     private $description;
  281.     /**
  282.      * @ORM\Column(type="string", length=255, nullable=true)
  283.      * @Groups({"Container:Read", "Container:Read-List", "Container:Write", "Container:Storage", "Container:Overview", "Container:PRead", "Client:MyClient", "ElCourse:PRead", "User:Get-RoleContainer", "RoleContainer:Read"})
  284.      *
  285.      * @EsUploadable()
  286.      */
  287.     protected $imageName;
  288.     /**
  289.      * @ORM\OneToMany(targetEntity=AFrameRoom::class, mappedBy="container")
  290.      */
  291.     private $aFrameRooms;
  292.     /**
  293.      * @ORM\OneToMany(targetEntity=Language::class, mappedBy="container")
  294.      * @Groups({"Container:MyContainer", "Client:MyClient"})
  295.      */
  296.     private $languages;
  297.     /**
  298.      * @ORM\Column(type="json", nullable=true)
  299.      * @Groups({"Container:Read", "Container:Write", "Container:Exp", "Container:Imp"})
  300.      *
  301.      * @Assert\Type(type="array", message="validation.container:navigation.type")
  302.      */
  303.     public $navigation = [];
  304.     /**
  305.      * @ORM\Column(type="boolean", nullable=true)
  306.      * @Groups({"Container:Read", "Container:Overview"})
  307.      */
  308.     private $isLiveNow;
  309.     private $isOwnershipValidationIgnore false;
  310.     /**
  311.      * @ORM\OneToMany(targetEntity=Background::class, mappedBy="container")
  312.      * @Groups({"Container:MyContainer"})
  313.      */
  314.     private $backgrounds;
  315.     /**
  316.      * @ORM\Column(type="json", nullable=true)
  317.      * @Groups({"Container:MyContainer"})
  318.      */
  319.     private $videoGalleryIds = [];
  320.     /**
  321.      * @ORM\Column(type="json", nullable=true)
  322.      * @Groups({"Container:Read", "Container:Write", "Container:SetUserFields", "Container:Exp", "Container:Imp"})
  323.      *
  324.      * @Assert\Type(type="array", message="validation.container:userStaticFields.type")
  325.      */
  326.     private $userStaticFields = [];
  327.     /**
  328.      * @ORM\ManyToOne(targetEntity=CommonCategory::class)
  329.      * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
  330.      * @Groups({"Container:ReadSecure", "Container:Write", "Container:Storage", "Container:PRead", "Container:Overview"})
  331.      */
  332.     private $containerCategory;
  333.     /**
  334.      * @ORM\Column(type="string", length=255, nullable=true)
  335.      * @Groups({"Container:ReadSecure", "Container:Read-List", "Container:Write", "Container:Storage", "Container:PRead", "Conference:PRead", "ElCourse:PRead", "Client:MyClient", "User:Get-RoleContainer", "RoleContainer:Read"})
  336.      *
  337.      * @EsUploadable()
  338.      */
  339.     protected $logoImageName;
  340.     /**
  341.      * @ORM\Column(type="boolean", nullable=true)
  342.      * @Groups({"Container:Read", "Container:Read-List", "Container:Write", "User:Get-RoleContainer", "RoleContainer:Read"})
  343.      */
  344.     private $isShowPublic;
  345.     /**
  346.      * @ORM\Column(type="boolean", nullable=true)
  347.      * @Groups({"Container:Read", "Container:Read-List", "Container:Write", "Client:MyClient", "User:Get-RoleContainer", "RoleContainer:Read"})
  348.      */
  349.     private $isMainContainer;
  350.     /**
  351.      * @ORM\Column(type="boolean", nullable=true)
  352.      * @Groups({"Container:Read", "Container:Read-List", "Container:Write", "User:Get-RoleContainer", "RoleContainer:Read"})
  353.      */
  354.     private $isShowPublicContainer;
  355.     /**
  356.      * @ORM\Column(type="boolean", nullable=true)
  357.      * @Groups({"Container:Read", "Container:Read-List", "Container:Write"})
  358.      */
  359.     private $isNewsfeedSharingEnable;
  360.     /**
  361.      * @ORM\ManyToMany(targetEntity=Container::class)
  362.      * @ORM\JoinTable(name="rel_sharing_container")
  363.      * @Groups({"Container:Read", "Container:Write", "Container:MyContainer"})
  364.      * @ApiProperty(readableLink=false, writableLink=false)
  365.      */
  366.     private $sharingContainers;
  367.     /**
  368.      * @ORM\Column(type="integer", nullable=true)
  369.      */
  370.     private $oldId;
  371.     /**
  372.      * @ORM\Column(type="boolean", nullable=true)
  373.      * @Groups({"Container:Read", "Container:Write", "Container:Read-List", "Container:Overview", "Client:Read"})
  374.      */
  375.     private $isLoginContainer;
  376.     /**
  377.      * @ORM\Column(type="decimal", precision=5, scale=2, nullable=true)
  378.      * @Groups({"Container:Read", "Container:Write", "Container:MyContainer"})
  379.      */
  380.     private $courseCommission;
  381.     public function __construct()
  382.     {
  383.         $configurationModel = new Configuration();
  384.         $this->configuration $configurationModel->getProperties();
  385.         $designConfigurationModel = new DesignConfiguration();
  386.         $this->designConfiguration $designConfigurationModel->getProperties();
  387.         $navigationModel = new Navigation();
  388.         $this->navigation $navigationModel->getProperties();
  389.         // $userStaticFieldModel = new UserStaticField();
  390.         // $this->userStaticFields = $userStaticFieldModel->getProperties();
  391.         $this->userGroups = new ArrayCollection();
  392.         $this->aFrameRooms = new ArrayCollection();
  393.         $this->languages = new ArrayCollection();
  394.         $this->backgrounds = new ArrayCollection();
  395.         $this->sharingContainers = new ArrayCollection();
  396.     }
  397.     public function getId(): ?int
  398.     {
  399.         return $this->id;
  400.     }
  401.     public function getDomain(): ?string
  402.     {
  403.         return $this->domain;
  404.     }
  405.     public function setDomain(string $domain): self
  406.     {
  407.         $this->domain $domain;
  408.         return $this;
  409.     }
  410.     public function getContainerGroup(): ?string
  411.     {
  412.         return $this->containerGroup;
  413.     }
  414.     public function setContainerGroup(?string $containerGroup): self
  415.     {
  416.         $this->containerGroup $containerGroup;
  417.         return $this;
  418.     }
  419.     public function getStorage(): ?string
  420.     {
  421.         return $this->storage;
  422.     }
  423.     public function setStorage(string $storage): self
  424.     {
  425.         $this->storage $storage;
  426.         return $this;
  427.     }
  428.     public function getBucketKey(): ?string
  429.     {
  430.         return $this->bucketKey;
  431.     }
  432.     public function setBucketKey(?string $bucketKey): self
  433.     {
  434.         $this->bucketKey $bucketKey;
  435.         return $this;
  436.     }
  437.     public function getBucketSecret(): ?string
  438.     {
  439.         return $this->bucketSecret;
  440.     }
  441.     public function setBucketSecret(?string $bucketSecret): self
  442.     {
  443.         $this->bucketSecret $bucketSecret;
  444.         return $this;
  445.     }
  446.     public function getBucketName(): ?string
  447.     {
  448.         return $this->bucketName;
  449.     }
  450.     public function setBucketName(?string $bucketName): self
  451.     {
  452.         $this->bucketName $bucketName;
  453.         return $this;
  454.     }
  455.     public function getIsActive(): ?bool
  456.     {
  457.         return $this->isActive;
  458.     }
  459.     public function setIsActive(?bool $isActive): self
  460.     {
  461.         $this->isActive $isActive;
  462.         return $this;
  463.     }
  464.     public function getClient(): ?Client
  465.     {
  466.         return $this->client;
  467.     }
  468.     public function setClient(?Client $client): self
  469.     {
  470.         $this->client $client;
  471.         return $this;
  472.     }
  473.     public function getConfiguration($key null$defaultValue null)
  474.     {
  475.         if (!empty($key)) {
  476.             return ($this->hasConfiguration($key)) ? $this->configuration[$key] : $defaultValue;
  477.         }
  478.         return $this->configuration;
  479.     }
  480.     public function setConfiguration(?array $configuration): self
  481.     {
  482.         if (!is_array($configuration)) {
  483.             return $this;
  484.         }
  485.         $configurationModel = new Configuration();
  486.         $this->configuration array_merge($configurationModel->getProperties(), $this->getConfiguration(), $configuration);
  487.         return $this;
  488.     }
  489.     public function hasConfiguration($key): bool
  490.     {
  491.         if (isset($this->configuration[$key])) {
  492.             return true;
  493.         }
  494.         return false;
  495.     }
  496.     public function replaceConfiguration(?array $configuration)
  497.     {
  498.         $this->configuration $configuration;
  499.     }
  500.     public function getCloneId()
  501.     {
  502.         return $this->cloneId ?? $this->id;
  503.     }
  504.     public function setCloneId($cloneId)
  505.     {
  506.         $this->cloneId $cloneId;
  507.         return $this;
  508.     }
  509.     /**
  510.         * @return Collection|UserGroup[]
  511.         */
  512.     public function getUserGroups(): Collection
  513.     {
  514.         return $this->userGroups;
  515.     }
  516.     public function getUserGroupIds()
  517.     {
  518.         $result = [];
  519.         foreach ($this->userGroups as $group) {
  520.             $result[] = $group->getId();
  521.         }
  522.         return $result;
  523.     }
  524.     public function addUserGroup(UserGroup $userGroup): self
  525.     {
  526.         if (!$this->userGroups->contains($userGroup)) {
  527.             $this->userGroups[] = $userGroup;
  528.         }
  529.         return $this;
  530.     }
  531.     public function removeUserGroup(UserGroup $userGroup): self
  532.     {
  533.         $this->userGroups->removeElement($userGroup);
  534.         return $this;
  535.     }
  536.     public function removeAllUserGroups(): self
  537.     {
  538.         foreach ($this->userGroups as $ug) {
  539.             $this->userGroups->removeElement($ug);
  540.         }
  541.         return $this;
  542.     }
  543.     public function getName(): ?string
  544.     {
  545.         return $this->name;
  546.     }
  547.     public function setName(string $name): self
  548.     {
  549.         $this->name $name;
  550.         return $this;
  551.     }
  552.     public function getBucketRegion(): ?string
  553.     {
  554.         return $this->bucketRegion;
  555.     }
  556.     public function setBucketRegion(?string $bucketRegion): self
  557.     {
  558.         $this->bucketRegion $bucketRegion;
  559.         return $this;
  560.     }
  561.     public function getDesignConfiguration($key null$defaultValue null)
  562.     {
  563.         if (!empty($key)) {
  564.             return ($this->hasDesignConfiguration($key)) ? $this->designConfiguration[$key] : $defaultValue;
  565.         }
  566.         return $this->designConfiguration;
  567.     }
  568.     public function setDesignConfiguration(?array $designConfiguration): self
  569.     {
  570.         if (!is_array($designConfiguration)) {
  571.             return $this;
  572.         }
  573.         $designConfigurationModel = new DesignConfiguration();
  574.         $this->designConfiguration array_merge($designConfigurationModel->getProperties(), $this->getDesignConfiguration(), $designConfiguration);
  575.         return $this;
  576.     }
  577.     public function hasDesignConfiguration($key): bool
  578.     {
  579.         if (isset($this->designConfiguration[$key])) {
  580.             return true;
  581.         }
  582.         return false;
  583.     }
  584.     public function getDescription(): ?string
  585.     {
  586.         return $this->description;
  587.     }
  588.     public function setDescription(?string $description): self
  589.     {
  590.         $this->description $description;
  591.         return $this;
  592.     }
  593.     /**
  594.      * @Groups({"Container:Read"})
  595.      */
  596.     public function getConfigurationTypes(): ?array
  597.     {
  598.         return ConfigurationType::CONFIGURATION_TYPES;
  599.     }
  600.     /**
  601.      * @Groups({"Container:Read"})
  602.      */
  603.     public function getDesignConfigurationTypes(): ?array
  604.     {
  605.         return DesignConfigurationType::DESIGN_CONFIGURATION_TYPES;
  606.     }
  607.     public function getImageName(): ?string
  608.     {
  609.         return $this->imageName;
  610.     }
  611.     public function setImageName(?string $imageName): self
  612.     {
  613.         $this->imageName $imageName;
  614.         return $this;
  615.     }
  616.     /**
  617.      * @return Collection|AFrameRoom[]
  618.      */
  619.     public function getAFrameRooms(): Collection
  620.     {
  621.         return $this->aFrameRooms;
  622.     }
  623.     public function addAFrameRoom(AFrameRoom $aFrameRoom): self
  624.     {
  625.         if (!$this->aFrameRooms->contains($aFrameRoom)) {
  626.             $this->aFrameRooms[] = $aFrameRoom;
  627.             $aFrameRoom->setContainer($this);
  628.         }
  629.         return $this;
  630.     }
  631.     public function removeAFrameRoom(AFrameRoom $aFrameRoom): self
  632.     {
  633.         if ($this->aFrameRooms->removeElement($aFrameRoom)) {
  634.             // set the owning side to null (unless already changed)
  635.             if ($aFrameRoom->getContainer() === $this) {
  636.                 $aFrameRoom->setContainer(null);
  637.             }
  638.         }
  639.         return $this;
  640.     }
  641.     public function getBucketEndpoint(): ?string
  642.     {
  643.         return $this->bucketEndpoint;
  644.     }
  645.     public function setBucketEndpoint(?string $bucketEndpoint): self
  646.     {
  647.         $this->bucketEndpoint $bucketEndpoint;
  648.         return $this;
  649.     }
  650.     /**
  651.      * @return Collection|Language[]
  652.      */
  653.     public function getLanguages(): Collection
  654.     {
  655.         return $this->languages;
  656.     }
  657.     public function getDefaultLanguage()
  658.     {
  659.         foreach ($this->languages as $l) {
  660.             if ($l->getIsDefault()) {
  661.                 return $l;
  662.             }
  663.         }
  664.         return false;
  665.     }
  666.     public function addLanguage(Language $language): self
  667.     {
  668.         if (!$this->languages->contains($language)) {
  669.             $this->languages[] = $language;
  670.             $language->setContainer($this);
  671.         }
  672.         return $this;
  673.     }
  674.     public function removeLanguage(Language $language): self
  675.     {
  676.         if ($this->languages->removeElement($language)) {
  677.             // set the owning side to null (unless already changed)
  678.             if ($language->getContainer() === $this) {
  679.                 $language->setContainer(null);
  680.             }
  681.         }
  682.         return $this;
  683.     }
  684.     public function getNavigation($key null): ?array
  685.     {
  686.         /*
  687.         if (!empty($key)) {
  688.             return ($this->hasNavigation($key)) ? $this->navigation[$key] : [];
  689.         }
  690.         */
  691.         if ($this->navigation === null) {
  692.             $this->navigation = [];
  693.         }
  694.         return $this->navigation;
  695.     }
  696.     public function setNavigation(?array $navigation): self
  697.     {
  698.         if (!is_array($navigation)) {
  699.             return $this;
  700.         }
  701.         //$navigationModel = new Navigation();
  702.         //$this->navigation = array_merge($navigationModel->getProperties(), $this->getNavigation(), $navigation);
  703.         $this->navigation $navigation;
  704.         return $this;
  705.     }
  706.     public function hasNavigation($key): bool
  707.     {
  708.         if (isset($this->navigation[$key])) {
  709.             return true;
  710.         }
  711.         return false;
  712.     }
  713.     public function getVhost()
  714.     {
  715.         return <<<VHOST
  716.         server {
  717.             server_name {$this->getDomain()};
  718.             root /home/srm/web/project/expertshare-frontend/root;
  719.             index index.html index.htm;
  720.             location / {
  721.                 try_files \$uri \$uri/ /index.html;
  722.             }
  723.         }
  724.         VHOST;
  725.     }
  726.     public function getIsLiveNow(): ?bool
  727.     {
  728.         return $this->isLiveNow;
  729.     }
  730.     public function setIsLiveNow(?bool $isLiveNow): self
  731.     {
  732.         $this->isLiveNow $isLiveNow;
  733.         return $this;
  734.     }
  735.     public function getIsOwnershipValidationIgnore(): ?bool
  736.     {
  737.         return $this->isOwnershipValidationIgnore;
  738.     }
  739.     public function setIsOwnershipValidationIgnore(?bool $isOwnershipValidationIgnore): self
  740.     {
  741.         $this->isOwnershipValidationIgnore $isOwnershipValidationIgnore;
  742.         return $this;
  743.     }
  744.     public function getBackgrounds()
  745.     {
  746.         return $this->backgrounds;
  747.     }
  748.     public function addBackground(Background $background): self
  749.     {
  750.         if (!$this->backgrounds->contains($background)) {
  751.             $this->backgrounds[] = $background;
  752.             $background->setContainer($this);
  753.         }
  754.         return $this;
  755.     }
  756.     public function removeBackground(Background $background): self
  757.     {
  758.         if ($this->backgrounds->removeElement($background)) {
  759.             // set the owning side to null (unless already changed)
  760.             if ($background->getContainer() === $this) {
  761.                 $background->setContainer(null);
  762.             }
  763.         }
  764.         return $this;
  765.     }
  766.     public function getVideoGalleryIds(): ?array
  767.     {
  768.         return $this->videoGalleryIds;
  769.     }
  770.     public function setVideoGalleryIds(?array $videoGalleryIds): self
  771.     {
  772.         $this->videoGalleryIds $videoGalleryIds;
  773.         return $this;
  774.     }
  775.     public function getUserStaticFields(): ?array
  776.     {
  777.         return $this->userStaticFields;
  778.     }
  779.     public function setUserStaticFields(?array $userStaticFields): self
  780.     {
  781.         $this->userStaticFields $userStaticFields;
  782.         return $this;
  783.     }
  784.     public function getContainerCategory(): ?CommonCategory
  785.     {
  786.         return $this->containerCategory;
  787.     }
  788.     public function setContainerCategory(?CommonCategory $containerCategory): self
  789.     {
  790.         $this->containerCategory $containerCategory;
  791.         return $this;
  792.     }
  793.     public function getLogoImageName(): ?string
  794.     {
  795.         return $this->logoImageName;
  796.     }
  797.     public function setLogoImageName(?string $logoImageName): self
  798.     {
  799.         $this->logoImageName $logoImageName;
  800.         return $this;
  801.     }
  802.     public function getIsShowPublic(): ?bool
  803.     {
  804.         return $this->isShowPublic;
  805.     }
  806.     public function setIsShowPublic(?bool $isShowPublic): self
  807.     {
  808.         $this->isShowPublic $isShowPublic;
  809.         return $this;
  810.     }
  811.     public function getIsMainContainer(): ?bool
  812.     {
  813.         return $this->isMainContainer;
  814.     }
  815.     public function setIsMainContainer(?bool $isMainContainer): self
  816.     {
  817.         $this->isMainContainer $isMainContainer;
  818.         return $this;
  819.     }
  820.     public function getIsShowPublicContainer(): ?bool
  821.     {
  822.         return $this->isShowPublicContainer;
  823.     }
  824.     public function setIsShowPublicContainer(?bool $isShowPublicContainer): self
  825.     {
  826.         $this->isShowPublicContainer $isShowPublicContainer;
  827.         return $this;
  828.     }
  829.     public function getIsNewsfeedSharingEnable(): ?bool
  830.     {
  831.         return $this->isNewsfeedSharingEnable;
  832.     }
  833.     public function setIsNewsfeedSharingEnable(?bool $isNewsfeedSharingEnable): self
  834.     {
  835.         $this->isNewsfeedSharingEnable $isNewsfeedSharingEnable;
  836.         return $this;
  837.     }
  838.     /**
  839.      * @return Collection<int, self>
  840.      */
  841.     public function getSharingContainers()
  842.     {
  843.         return $this->sharingContainers;
  844.     }
  845.     public function addSharingContainer(self $sharingContainer): self
  846.     {
  847.         if (!$this->sharingContainers->contains($sharingContainer)) {
  848.             $this->sharingContainers[] = $sharingContainer;
  849.         }
  850.         return $this;
  851.     }
  852.     public function removeSharingContainer(self $sharingContainer): self
  853.     {
  854.         $this->sharingContainers->removeElement($sharingContainer);
  855.         return $this;
  856.     }
  857.     public function getSharingContainerIds()
  858.     {
  859.         $result = [];
  860.         foreach ($this->sharingContainers as $sc) {
  861.             if ($sc->getIsNewsfeedSharingEnable()) {
  862.                 $result[] = $sc->getId();
  863.             }
  864.         }
  865.         return $result;
  866.     }
  867.     public function hasLocale($locale)
  868.     {
  869.         foreach ($this->getLanguages() as $language) {
  870.             if ($language->getLocale() === $locale) {
  871.                 return true;
  872.             }
  873.         }
  874.         return false;
  875.     }
  876.     public function getDefaultLanauge()
  877.     {
  878.         foreach ($this->getLanguages() as $language) {
  879.             if ($language->getIsDefault()) {
  880.                 return $language;
  881.             }
  882.         }
  883.         return false;
  884.     }
  885.     public function getOldId(): ?int
  886.     {
  887.         return $this->oldId;
  888.     }
  889.     public function setOldId(?int $oldId): self
  890.     {
  891.         $this->oldId $oldId;
  892.         return $this;
  893.     }
  894.     public function getIsLoginContainer(): ?bool
  895.     {
  896.         return $this->isLoginContainer;
  897.     }
  898.     public function setIsLoginContainer(?bool $isLoginContainer): self
  899.     {
  900.         $this->isLoginContainer $isLoginContainer;
  901.         return $this;
  902.     }
  903.     /**
  904.      * @Groups({"Container:Storage", "Conference:PRead", "Container:PRead"})
  905.      */
  906.     public function getSharedDesignConfiguration()
  907.     {
  908.         return [
  909.             'defImageNewsfeed' => isset($this->designConfiguration['defImageNewsfeed']) ? $this->designConfiguration['defImageNewsfeed'] : "",
  910.             'genImageFavicon' => isset($this->designConfiguration['genImageFavicon']) ? $this->designConfiguration['genImageFavicon'] : ""
  911.         ];
  912.     }
  913.     public function getCourseCommission(): ?string
  914.     {
  915.         return $this->courseCommission;
  916.     }
  917.     public function setCourseCommission(?string $courseCommission): self
  918.     {
  919.         $this->courseCommission $courseCommission;
  920.         return $this;
  921.     }
  922. }