<?php
namespace App\Entity;
use App\Repository\InstanceViewRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=InstanceViewRepository::class)
* @ORM\Table(name="instance_view", uniqueConstraints={
* @ORM\UniqueConstraint(name="uniq_view_per_instance", columns={"instance_id", "name"})
* })
*/
class InstanceView
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Instance::class)
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
*/
private $instance;
/**
* @ORM\Column(type="string", length=180)
*/
private $name;
/**
* @ORM\Column(type="string", length=180, nullable=true)
*/
private $displayName;
/**
* @ORM\Column(name="row_pos", type="integer", options={"default" = 1})
*/
private $row = 1;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $glbPath;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $meshGroupName;
/**
* @ORM\Column(type="json", nullable=true)
*/
private $meshPropertyMap;
/**
* @ORM\Column(type="boolean")
*/
private $isDefault = false;
/**
* @ORM\Column(type="boolean", options={"default" = 0})
*/
private $showOnHomepage = false;
/**
* @ORM\Column(name="sort_order", type="integer", options={"default" = 0})
*/
private $sortOrder = 0;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $icon;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $updatedAt;
public function __construct()
{
$now = new \DateTimeImmutable();
$this->createdAt = $now;
$this->updatedAt = $now;
}
public function getId(): ?int
{
return $this->id;
}
public function getInstance(): ?Instance
{
return $this->instance;
}
public function setInstance(Instance $instance): self
{
$this->instance = $instance;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDisplayName(): ?string
{
return $this->displayName ?? $this->name;
}
public function setDisplayName(?string $displayName): self
{
$this->displayName = $displayName;
return $this;
}
public function getRow(): int
{
return $this->row ?? 1;
}
public function setRow(int $row): self
{
if ($row <= 0) {
$row = 1;
}
$this->row = $row;
return $this;
}
public function getGlbPath(): ?string
{
return $this->glbPath;
}
public function setGlbPath(?string $glbPath): self
{
$this->glbPath = $glbPath;
return $this;
}
public function getMeshGroupName(): ?string
{
return $this->meshGroupName;
}
public function setMeshGroupName(?string $meshGroupName): self
{
$this->meshGroupName = $meshGroupName;
return $this;
}
public function getMeshPropertyMap(): ?array
{
return $this->meshPropertyMap;
}
public function setMeshPropertyMap(?array $meshPropertyMap): self
{
$this->meshPropertyMap = $meshPropertyMap;
return $this;
}
public function isDefault(): bool
{
return (bool) $this->isDefault;
}
public function setIsDefault(bool $isDefault): self
{
$this->isDefault = $isDefault;
return $this;
}
public function isShowOnHomepage(): bool
{
return (bool) $this->showOnHomepage;
}
public function setShowOnHomepage(bool $showOnHomepage): self
{
$this->showOnHomepage = $showOnHomepage;
return $this;
}
public function getSortOrder(): int
{
return $this->sortOrder ?? 0;
}
public function setSortOrder(int $sortOrder): self
{
$this->sortOrder = $sortOrder;
return $this;
}
public function getIcon(): ?string
{
return $this->icon;
}
public function setIcon(?string $icon): self
{
$this->icon = $icon;
return $this;
}
public function getCreatedAt(): \DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): \DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
}