src/Entity/Site/Config.php line 17
<?php
namespace App\Entity\Site;
use App\Entity\Traits\TrackerFields;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Traits\CreatedTrait;
use App\Entity\Traits\DeletedTrait;
use App\Entity\Traits\UpdatedTrait;
use App\Entity\Traits\UserCreatedInterface;
use App\Entity\Traits\UserUpdatedInterface;
#[ORM\Table(name: 'site_config')]
#[ORM\Entity(repositoryClass: 'App\Repository\Site\ConfigRepository')]
#[ORM\HasLifecycleCallbacks]
class Config implements UserCreatedInterface, UserUpdatedInterface
{
use TrackerFields;
public const HTML = 'html';
public const STRING = 'string';
public const INT = 'int';
public const TEXT = 'text';
public const IMAGE = 'image';
public const LINK = 'link';
public const DATE = 'date';
public const DATETIME = 'datetime';
public const BOOL = 'boolean';
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Column(type: 'integer')]
private ?int $id;
#[ORM\Column(type: 'string', nullable: false)]
private ?string $slug;
#[ORM\Column(type: 'string', nullable: false)]
private ?string $caption;
#[ORM\Column(type: 'json', nullable: true)]
private array $value = [];
#[ORM\Column(type: 'json', name: 'schema_array', nullable: true)]
private array $schema = [];
public static function getRowTypes(): array
{
return [
self::HTML,
self::STRING,
self::INT,
self::TEXT,
self::IMAGE,
self::LINK,
self::BOOL,
self::DATE,
self::DATETIME
];
}
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @param int|null $id
*/
public function setId(?int $id): void
{
$this->id = $id;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): void
{
$this->slug = $slug;
}
/**
* @return string|null
*/
public function getCaption(): ?string
{
return $this->caption;
}
/**
* @param string|null $caption
*/
public function setCaption(?string $caption): void
{
$this->caption = $caption;
}
/**
* @return array
*/
public function getValue(): array
{
return $this->value;
}
/**
* @param array $value
*/
public function setValue(array $value): void
{
$this->value = $value;
}
/**
* @return array
*/
public function getSchema(): array
{
return $this->schema;
}
public function getSchemaItem($slug):?array{
foreach($this->schema as $item){
if($item['slug']==$slug) return $item;
}
return null;
}
/**
* @param array $schema
*/
public function setSchema(array $schema): void
{
$this->schema = $schema;
}
}