<?php
namespace App\Entity;
use App\Annotation\EsUploadable;
use App\Entity\Model\Navigation;
use Doctrine\ORM\Mapping as ORM;
use App\Controller\ContainerClone;
use App\Entity\Model\Configuration;
use App\Entity\Model\UserStaticField;
use App\Entity\Model\ConfigurationType;
use App\Repository\ContainerRepository;
use App\Entity\Model\DesignConfiguration;
use ApiPlatform\Core\Annotation\ApiFilter;
use App\Entity\Traits\TimestampableEntity;
use Doctrine\Common\Collections\Collection;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Entity\Model\DesignConfigurationType;
use App\Validator\Constraints as CustomAssert;
use App\Entity\Interfaces\ClientMappedInterface;
use App\Entity\Interfaces\UploadMappedInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ApiResource(
* normalizationContext={"groups"={"Container:Read"}, "skip_null_values"=false},
* denormalizationContext={"groups"={"Container:Write"}},
* collectionOperations={
* "post"={"security"="is_granted('ROLE_ADMIN')"},
* "post_clone"={
* "route_name"="api_containers_clone_collection",
* "method"="POST",
* "denormalization_context"={"groups"={"Container:Clone"}},
* "security"="is_granted('ROLE_ADMIN')"
* },
* "post_gen_style_request"={
* "route_name"="api_containers_gen_style_request_collection",
* "method"="POST",
* "denormalization_context"={"groups"={"Container:GenStyle"}},
* "security"="is_granted('ROLE_OPERATOR')"
* },
* "post_gen_translation_request"={
* "route_name"="api_containers_gen_translation_request_collection",
* "method"="POST",
* "denormalization_context"={"groups"={"Container:GenTranslation"}},
* "security"="is_granted('ROLE_OPERATOR')"
* },
* "post_publish_navigation_request"={
* "route_name"="api_containers_publish_navigation_request_collection",
* "method"="POST",
* "denormalization_context"={"groups"={"Container:PublishNavigation"}},
* "security"="is_granted('ROLE_OPERATOR')"
* },
* "post_reset_email_template"={
* "route_name"="api_containers_reset_email_template_collection",
* "method"="POST",
* "security"="is_granted('ROLE_ADMIN')"
* },
* "post_reset_email_template_ac"={
* "route_name"="api_containers_reset_email_template_ac_collection",
* "method"="POST",
* "security"="is_granted('ROLE_SUPER_ADMIN')"
* },
* "post_reset_email_template_acc"={
* "route_name"="api_containers_reset_email_template_acc_collection",
* "method"="POST",
* "security"="is_granted('ROLE_SUPER_ADMIN')"
* },
* "post_add_newsfeed_sharing"={
* "route_name"="api_containers_add_newsfeed_sharing_collection",
* "method"="POST",
* "security"="is_granted('ROLE_SUPER_ADMIN')"
* },
* "get"={
* "security"="is_granted('ROLE_ADMIN')",
* "normalization_context"={"groups"={"Container:Read-List"}, "skip_null_values"=false},
* "pagination_enabled"=false
* },
* "get_overview"={
* "path"="/containers/overview",
* "method"="GET",
* "normalization_context"={"groups"={"Container:Overview"}, "skip_null_values"=false},
* "security"="is_granted('IS_AUTHENTICATED_FULLY')"
* },
* "get_my_container"={
* "route_name"="api_containers_my_container_collection",
* "method"="GET",
* "normalization_context"={"groups"={"Container:Read", "Container:MyContainer"}, "skip_null_values"=false}
* },
* "get_for_public_page"={
* "route_name"="api_pub_containers_get_for_public_page_collection",
* "method"="GET",
* "security"="is_granted('PUBLIC_ACCESS')",
* "normalization_context"={"groups"={"Container:PRead"}, "skip_null_values"=false},
* "pagination_enabled"=true
* },
* },
* itemOperations={
* "get"={"security"="is_granted('IS_AUTHENTICATED_FULLY', object)"},
* "get_secure"={
* "path"="/containers/{id}/secure",
* "method"="GET",
* "security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_ADMIN')",
* "normalization_context"={"groups"={"Container:Read", "Container:ReadSecure"}, "skip_null_values"=false}
* },
* "put"={"security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_ADMIN')"},
* "patch"={"security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_OPERATOR')"},
* "patch_set_user_fields"={
* "route_name"="api_containers_set_user_fields_collection",
* "method"="PATCH",
* "denormalization_context"={"groups"={"Container:SetUserFields"}},
* "security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_OPERATOR')"
* },
* "patch_set_main_container"={
* "route_name"="api_containers_set_main_container_collection",
* "method"="PATCH",
* "denormalization_context"={"groups"={"Container:SetMainContainer"}},
* "security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_OPERATOR')"
* },
* "patch_set_login_container"={
* "route_name"="api_containers_set_login_container_collection",
* "method"="PATCH",
* "denormalization_context"={"groups"={"Container:SetLoginContainer"}},
* "security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_OPERATOR')"
* },
* "delete"={"security"="is_granted('IS_CLIENT_OWNER', object) && is_granted('ROLE_ADMIN')"}
* }
* )
* @ApiFilter(SearchFilter::class, properties={"client.id": "exact", "userGroups.id", "exact", "sharingContainers.id": "exact", "domain": "partial", "name": "partial", "containerCategory.id": "exact"})
* @ApiFilter(BooleanFilter::class, properties={"isActive", "isNewsfeedSharingEnable", "isLoginContainer"})
* @ApiFilter(OrderFilter::class, properties={"id", "name": "ASC", "domain"})
* @ORM\Entity(repositoryClass=ContainerRepository::class)
* @UniqueEntity(fields={"domain"})
* @ORM\Table(name="container",indexes={@ORM\Index(name="container_domain_idx", columns={"domain"})})
*/
class Container implements ClientMappedInterface, UploadMappedInterface
{
/**
* Hook timestampable behavior
* updates createdAt, updatedAt fields
*/
use TimestampableEntity;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @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"})
*/
private $id;
/**
* @ORM\Column(type="string", length=128, unique=true)
* @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"})
*
* @Assert\NotBlank(message="validation.container:domain.notBlank")
* @Assert\Length(max=128, maxMessage="validation.container:domain.max")
*/
private $domain;
/**
* @ORM\Column(type="string", length=255)
* @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"})
*
* @Assert\NotBlank(message="validation.container:name.notBlank")
* @Assert\Length(max=255, maxMessage="validation.container:name.max")
*/
private $name;
/**
* @ORM\Column(type="string", length=32, nullable=true)
* @Groups({"Container:Read", "Container:Write"})
*
* @Assert\Length(max=32, maxMessage="validation.container:containerGroup.max")
*/
private $containerGroup;
/**
* @ORM\Column(type="string", length=16)
* @ApiProperty(
* attributes={
* "openapi_context"={
* "type"="string",
* "enum"={self::STORAGE_LOCAL, self::STORAGE_S3}
* }
* }
* )
* @Groups({"Container:Clone", "Container:Read", "Container:Read-List", "Container:Write", "Container:Storage", "Container:PRead", "Conference:PRead", "Session:PRead", "ElCourse:PRead", "VideoGallery:PRead", "Client:MyClient"})
*
* @Assert\NotBlank(message="validation.container:storage.notBlank")
* @Assert\Choice({self::STORAGE_LOCAL, self::STORAGE_S3})
*/
private $storage;
public const STORAGE_LOCAL = "Local";
public const STORAGE_S3 = "S3";
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"Container:Clone", "Container:ReadSecure", "Container:Write"})
*
* @Assert\Length(max=255, maxMessage="validation.container:bucketKey.max")
* @CustomAssert\CheckPropertyValues(field = "getStorage", constant ={self::STORAGE_S3}, constraints = {
* @Assert\NotBlank(message="validation.container:bucketKey.notBlank")
* })
*/
private $bucketKey;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"Container:Clone", "Container:ReadSecure", "Container:Write"})
*
* @Assert\Length(max=255, maxMessage="validation.container:bucketSecret.max")
* @CustomAssert\CheckPropertyValues(field = "getStorage", constant ={self::STORAGE_S3}, constraints = {
* @Assert\NotBlank(message="validation.container:bucketSecret.notBlank")
* })
*/
private $bucketSecret;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"Container:Clone", "Container:Read", "Container:Write", "Container:Storage", "Container:PRead", "Conference:PRead", "Session:PRead", "ElCourse:PRead", "VideoGallery:PRead", "Client:MyClient"})
*
* @Assert\Length(max=255, maxMessage="validation.container:bucketName.max")
* @CustomAssert\CheckPropertyValues(field = "getStorage", constant ={self::STORAGE_S3}, constraints = {
* @Assert\NotBlank(message="validation.container:bucketName.notBlank")
* })
*/
private $bucketName;
/**
* @ORM\Column(type="string", length=64, nullable=true)
* @Groups({"Container:Clone", "Container:Read", "Container:Write", "Container:Storage", "Container:PRead", "Conference:PRead", "Session:PRead", "ElCourse:PRead", "VideoGallery:PRead", "Client:MyClient"})
*
* @Assert\Length(max=64, maxMessage="validation.container:bucketRegion.max")
* @CustomAssert\CheckPropertyValues(field = "getStorage", constant ={self::STORAGE_S3}, constraints = {
* @Assert\NotBlank(message="validation.container:bucketRegion.notBlank")
* })
*/
private $bucketRegion;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"Container:Clone", "Container:Read", "Container:Write", "Container:Storage", "Container:PRead", "Conference:PRead", "Session:PRead", "ElCourse:PRead", "VideoGallery:PRead", "Client:MyClient"})
*
* @Assert\Length(max=255, maxMessage="validation.container:bucketEndpoint.max")
*/
private $bucketEndpoint;
/**
* @ORM\Column(type="boolean", nullable=true)
* @Groups({"Container:Read", "Container:Read-List", "Container:Write", "User:Get-RoleContainer", "RoleContainer:Read"})
*
* @Assert\Type(type="bool", message="validation.container:isActive.typeBool")
*/
private $isActive;
/**
* @ORM\ManyToOne(targetEntity=Client::class, inversedBy="containers")
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
* @Groups({"Container:Read", "Container:Write", "Container:PRead"})
*/
private $client;
/**
* @ORM\Column(type="json", nullable=true)
* @Groups({"Container:Read", "Container:Write", "Container:Exp", "Container:Imp", "Client:MyClient"})
*
* @Assert\Type(type="array", message="validation.container:configuration.type")
*/
public $configuration = [];
/**
* @Groups({"Container:Clone", "Container:GenStyle", "Container:GenTranslation", "Container:PublishNavigation"})
*/
private int $cloneId;
/**
* @ORM\ManyToMany(targetEntity=UserGroup::class, inversedBy="containers")
* @Groups({"Container:Read", "Container:Write"})
*/
private $userGroups;
/**
* @ORM\Column(type="array", nullable=true)
* @Groups({"Container:Read", "Container:Write", "Container:Exp", "Container:Imp", "Client:MyClient"})
*/
private $designConfiguration = [];
/**
* @ORM\Column(type="text", nullable=true)
* @Groups({"Container:Read", "Container:Write", "Container:Overview", "Container:PRead", "Conference:PRead", "ElCourse:PRead"})
*/
private $description;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"Container:Read", "Container:Read-List", "Container:Write", "Container:Storage", "Container:Overview", "Container:PRead", "Client:MyClient", "ElCourse:PRead", "User:Get-RoleContainer", "RoleContainer:Read"})
*
* @EsUploadable()
*/
protected $imageName;
/**
* @ORM\OneToMany(targetEntity=AFrameRoom::class, mappedBy="container")
*/
private $aFrameRooms;
/**
* @ORM\OneToMany(targetEntity=Language::class, mappedBy="container")
* @Groups({"Container:MyContainer", "Client:MyClient"})
*/
private $languages;
/**
* @ORM\Column(type="json", nullable=true)
* @Groups({"Container:Read", "Container:Write", "Container:Exp", "Container:Imp"})
*
* @Assert\Type(type="array", message="validation.container:navigation.type")
*/
public $navigation = [];
/**
* @ORM\Column(type="boolean", nullable=true)
* @Groups({"Container:Read", "Container:Overview"})
*/
private $isLiveNow;
private $isOwnershipValidationIgnore = false;
/**
* @ORM\OneToMany(targetEntity=Background::class, mappedBy="container")
* @Groups({"Container:MyContainer"})
*/
private $backgrounds;
/**
* @ORM\Column(type="json", nullable=true)
* @Groups({"Container:MyContainer"})
*/
private $videoGalleryIds = [];
/**
* @ORM\Column(type="json", nullable=true)
* @Groups({"Container:Read", "Container:Write", "Container:SetUserFields", "Container:Exp", "Container:Imp"})
*
* @Assert\Type(type="array", message="validation.container:userStaticFields.type")
*/
private $userStaticFields = [];
/**
* @ORM\ManyToOne(targetEntity=CommonCategory::class)
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
* @Groups({"Container:ReadSecure", "Container:Write", "Container:Storage", "Container:PRead", "Container:Overview"})
*/
private $containerCategory;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"Container:ReadSecure", "Container:Read-List", "Container:Write", "Container:Storage", "Container:PRead", "Conference:PRead", "ElCourse:PRead", "Client:MyClient", "User:Get-RoleContainer", "RoleContainer:Read"})
*
* @EsUploadable()
*/
protected $logoImageName;
/**
* @ORM\Column(type="boolean", nullable=true)
* @Groups({"Container:Read", "Container:Read-List", "Container:Write", "User:Get-RoleContainer", "RoleContainer:Read"})
*/
private $isShowPublic;
/**
* @ORM\Column(type="boolean", nullable=true)
* @Groups({"Container:Read", "Container:Read-List", "Container:Write", "Client:MyClient", "User:Get-RoleContainer", "RoleContainer:Read"})
*/
private $isMainContainer;
/**
* @ORM\Column(type="boolean", nullable=true)
* @Groups({"Container:Read", "Container:Read-List", "Container:Write", "User:Get-RoleContainer", "RoleContainer:Read"})
*/
private $isShowPublicContainer;
/**
* @ORM\Column(type="boolean", nullable=true)
* @Groups({"Container:Read", "Container:Read-List", "Container:Write"})
*/
private $isNewsfeedSharingEnable;
/**
* @ORM\ManyToMany(targetEntity=Container::class)
* @ORM\JoinTable(name="rel_sharing_container")
* @Groups({"Container:Read", "Container:Write", "Container:MyContainer"})
* @ApiProperty(readableLink=false, writableLink=false)
*/
private $sharingContainers;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $oldId;
/**
* @ORM\Column(type="boolean", nullable=true)
* @Groups({"Container:Read", "Container:Write", "Container:Read-List", "Container:Overview", "Client:Read"})
*/
private $isLoginContainer;
/**
* @ORM\Column(type="decimal", precision=5, scale=2, nullable=true)
* @Groups({"Container:Read", "Container:Write", "Container:MyContainer"})
*/
private $courseCommission;
public function __construct()
{
$configurationModel = new Configuration();
$this->configuration = $configurationModel->getProperties();
$designConfigurationModel = new DesignConfiguration();
$this->designConfiguration = $designConfigurationModel->getProperties();
$navigationModel = new Navigation();
$this->navigation = $navigationModel->getProperties();
// $userStaticFieldModel = new UserStaticField();
// $this->userStaticFields = $userStaticFieldModel->getProperties();
$this->userGroups = new ArrayCollection();
$this->aFrameRooms = new ArrayCollection();
$this->languages = new ArrayCollection();
$this->backgrounds = new ArrayCollection();
$this->sharingContainers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDomain(): ?string
{
return $this->domain;
}
public function setDomain(string $domain): self
{
$this->domain = $domain;
return $this;
}
public function getContainerGroup(): ?string
{
return $this->containerGroup;
}
public function setContainerGroup(?string $containerGroup): self
{
$this->containerGroup = $containerGroup;
return $this;
}
public function getStorage(): ?string
{
return $this->storage;
}
public function setStorage(string $storage): self
{
$this->storage = $storage;
return $this;
}
public function getBucketKey(): ?string
{
return $this->bucketKey;
}
public function setBucketKey(?string $bucketKey): self
{
$this->bucketKey = $bucketKey;
return $this;
}
public function getBucketSecret(): ?string
{
return $this->bucketSecret;
}
public function setBucketSecret(?string $bucketSecret): self
{
$this->bucketSecret = $bucketSecret;
return $this;
}
public function getBucketName(): ?string
{
return $this->bucketName;
}
public function setBucketName(?string $bucketName): self
{
$this->bucketName = $bucketName;
return $this;
}
public function getIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(?bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getClient(): ?Client
{
return $this->client;
}
public function setClient(?Client $client): self
{
$this->client = $client;
return $this;
}
public function getConfiguration($key = null, $defaultValue = null)
{
if (!empty($key)) {
return ($this->hasConfiguration($key)) ? $this->configuration[$key] : $defaultValue;
}
return $this->configuration;
}
public function setConfiguration(?array $configuration): self
{
if (!is_array($configuration)) {
return $this;
}
$configurationModel = new Configuration();
$this->configuration = array_merge($configurationModel->getProperties(), $this->getConfiguration(), $configuration);
return $this;
}
public function hasConfiguration($key): bool
{
if (isset($this->configuration[$key])) {
return true;
}
return false;
}
public function replaceConfiguration(?array $configuration)
{
$this->configuration = $configuration;
}
public function getCloneId()
{
return $this->cloneId ?? $this->id;
}
public function setCloneId($cloneId)
{
$this->cloneId = $cloneId;
return $this;
}
/**
* @return Collection|UserGroup[]
*/
public function getUserGroups(): Collection
{
return $this->userGroups;
}
public function getUserGroupIds()
{
$result = [];
foreach ($this->userGroups as $group) {
$result[] = $group->getId();
}
return $result;
}
public function addUserGroup(UserGroup $userGroup): self
{
if (!$this->userGroups->contains($userGroup)) {
$this->userGroups[] = $userGroup;
}
return $this;
}
public function removeUserGroup(UserGroup $userGroup): self
{
$this->userGroups->removeElement($userGroup);
return $this;
}
public function removeAllUserGroups(): self
{
foreach ($this->userGroups as $ug) {
$this->userGroups->removeElement($ug);
}
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getBucketRegion(): ?string
{
return $this->bucketRegion;
}
public function setBucketRegion(?string $bucketRegion): self
{
$this->bucketRegion = $bucketRegion;
return $this;
}
public function getDesignConfiguration($key = null, $defaultValue = null)
{
if (!empty($key)) {
return ($this->hasDesignConfiguration($key)) ? $this->designConfiguration[$key] : $defaultValue;
}
return $this->designConfiguration;
}
public function setDesignConfiguration(?array $designConfiguration): self
{
if (!is_array($designConfiguration)) {
return $this;
}
$designConfigurationModel = new DesignConfiguration();
$this->designConfiguration = array_merge($designConfigurationModel->getProperties(), $this->getDesignConfiguration(), $designConfiguration);
return $this;
}
public function hasDesignConfiguration($key): bool
{
if (isset($this->designConfiguration[$key])) {
return true;
}
return false;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @Groups({"Container:Read"})
*/
public function getConfigurationTypes(): ?array
{
return ConfigurationType::CONFIGURATION_TYPES;
}
/**
* @Groups({"Container:Read"})
*/
public function getDesignConfigurationTypes(): ?array
{
return DesignConfigurationType::DESIGN_CONFIGURATION_TYPES;
}
public function getImageName(): ?string
{
return $this->imageName;
}
public function setImageName(?string $imageName): self
{
$this->imageName = $imageName;
return $this;
}
/**
* @return Collection|AFrameRoom[]
*/
public function getAFrameRooms(): Collection
{
return $this->aFrameRooms;
}
public function addAFrameRoom(AFrameRoom $aFrameRoom): self
{
if (!$this->aFrameRooms->contains($aFrameRoom)) {
$this->aFrameRooms[] = $aFrameRoom;
$aFrameRoom->setContainer($this);
}
return $this;
}
public function removeAFrameRoom(AFrameRoom $aFrameRoom): self
{
if ($this->aFrameRooms->removeElement($aFrameRoom)) {
// set the owning side to null (unless already changed)
if ($aFrameRoom->getContainer() === $this) {
$aFrameRoom->setContainer(null);
}
}
return $this;
}
public function getBucketEndpoint(): ?string
{
return $this->bucketEndpoint;
}
public function setBucketEndpoint(?string $bucketEndpoint): self
{
$this->bucketEndpoint = $bucketEndpoint;
return $this;
}
/**
* @return Collection|Language[]
*/
public function getLanguages(): Collection
{
return $this->languages;
}
public function getDefaultLanguage()
{
foreach ($this->languages as $l) {
if ($l->getIsDefault()) {
return $l;
}
}
return false;
}
public function addLanguage(Language $language): self
{
if (!$this->languages->contains($language)) {
$this->languages[] = $language;
$language->setContainer($this);
}
return $this;
}
public function removeLanguage(Language $language): self
{
if ($this->languages->removeElement($language)) {
// set the owning side to null (unless already changed)
if ($language->getContainer() === $this) {
$language->setContainer(null);
}
}
return $this;
}
public function getNavigation($key = null): ?array
{
/*
if (!empty($key)) {
return ($this->hasNavigation($key)) ? $this->navigation[$key] : [];
}
*/
if ($this->navigation === null) {
$this->navigation = [];
}
return $this->navigation;
}
public function setNavigation(?array $navigation): self
{
if (!is_array($navigation)) {
return $this;
}
//$navigationModel = new Navigation();
//$this->navigation = array_merge($navigationModel->getProperties(), $this->getNavigation(), $navigation);
$this->navigation = $navigation;
return $this;
}
public function hasNavigation($key): bool
{
if (isset($this->navigation[$key])) {
return true;
}
return false;
}
public function getVhost()
{
return <<<VHOST
server {
server_name {$this->getDomain()};
root /home/srm/web/project/expertshare-frontend/root;
index index.html index.htm;
location / {
try_files \$uri \$uri/ /index.html;
}
}
VHOST;
}
public function getIsLiveNow(): ?bool
{
return $this->isLiveNow;
}
public function setIsLiveNow(?bool $isLiveNow): self
{
$this->isLiveNow = $isLiveNow;
return $this;
}
public function getIsOwnershipValidationIgnore(): ?bool
{
return $this->isOwnershipValidationIgnore;
}
public function setIsOwnershipValidationIgnore(?bool $isOwnershipValidationIgnore): self
{
$this->isOwnershipValidationIgnore = $isOwnershipValidationIgnore;
return $this;
}
public function getBackgrounds()
{
return $this->backgrounds;
}
public function addBackground(Background $background): self
{
if (!$this->backgrounds->contains($background)) {
$this->backgrounds[] = $background;
$background->setContainer($this);
}
return $this;
}
public function removeBackground(Background $background): self
{
if ($this->backgrounds->removeElement($background)) {
// set the owning side to null (unless already changed)
if ($background->getContainer() === $this) {
$background->setContainer(null);
}
}
return $this;
}
public function getVideoGalleryIds(): ?array
{
return $this->videoGalleryIds;
}
public function setVideoGalleryIds(?array $videoGalleryIds): self
{
$this->videoGalleryIds = $videoGalleryIds;
return $this;
}
public function getUserStaticFields(): ?array
{
return $this->userStaticFields;
}
public function setUserStaticFields(?array $userStaticFields): self
{
$this->userStaticFields = $userStaticFields;
return $this;
}
public function getContainerCategory(): ?CommonCategory
{
return $this->containerCategory;
}
public function setContainerCategory(?CommonCategory $containerCategory): self
{
$this->containerCategory = $containerCategory;
return $this;
}
public function getLogoImageName(): ?string
{
return $this->logoImageName;
}
public function setLogoImageName(?string $logoImageName): self
{
$this->logoImageName = $logoImageName;
return $this;
}
public function getIsShowPublic(): ?bool
{
return $this->isShowPublic;
}
public function setIsShowPublic(?bool $isShowPublic): self
{
$this->isShowPublic = $isShowPublic;
return $this;
}
public function getIsMainContainer(): ?bool
{
return $this->isMainContainer;
}
public function setIsMainContainer(?bool $isMainContainer): self
{
$this->isMainContainer = $isMainContainer;
return $this;
}
public function getIsShowPublicContainer(): ?bool
{
return $this->isShowPublicContainer;
}
public function setIsShowPublicContainer(?bool $isShowPublicContainer): self
{
$this->isShowPublicContainer = $isShowPublicContainer;
return $this;
}
public function getIsNewsfeedSharingEnable(): ?bool
{
return $this->isNewsfeedSharingEnable;
}
public function setIsNewsfeedSharingEnable(?bool $isNewsfeedSharingEnable): self
{
$this->isNewsfeedSharingEnable = $isNewsfeedSharingEnable;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getSharingContainers()
{
return $this->sharingContainers;
}
public function addSharingContainer(self $sharingContainer): self
{
if (!$this->sharingContainers->contains($sharingContainer)) {
$this->sharingContainers[] = $sharingContainer;
}
return $this;
}
public function removeSharingContainer(self $sharingContainer): self
{
$this->sharingContainers->removeElement($sharingContainer);
return $this;
}
public function getSharingContainerIds()
{
$result = [];
foreach ($this->sharingContainers as $sc) {
if ($sc->getIsNewsfeedSharingEnable()) {
$result[] = $sc->getId();
}
}
return $result;
}
public function hasLocale($locale)
{
foreach ($this->getLanguages() as $language) {
if ($language->getLocale() === $locale) {
return true;
}
}
return false;
}
public function getDefaultLanauge()
{
foreach ($this->getLanguages() as $language) {
if ($language->getIsDefault()) {
return $language;
}
}
return false;
}
public function getOldId(): ?int
{
return $this->oldId;
}
public function setOldId(?int $oldId): self
{
$this->oldId = $oldId;
return $this;
}
public function getIsLoginContainer(): ?bool
{
return $this->isLoginContainer;
}
public function setIsLoginContainer(?bool $isLoginContainer): self
{
$this->isLoginContainer = $isLoginContainer;
return $this;
}
/**
* @Groups({"Container:Storage", "Conference:PRead", "Container:PRead"})
*/
public function getSharedDesignConfiguration()
{
return [
'defImageNewsfeed' => isset($this->designConfiguration['defImageNewsfeed']) ? $this->designConfiguration['defImageNewsfeed'] : "",
'genImageFavicon' => isset($this->designConfiguration['genImageFavicon']) ? $this->designConfiguration['genImageFavicon'] : ""
];
}
public function getCourseCommission(): ?string
{
return $this->courseCommission;
}
public function setCourseCommission(?string $courseCommission): self
{
$this->courseCommission = $courseCommission;
return $this;
}
}