2018-09-21 15:48:23 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Entity\Attribut;
|
|
|
|
|
2019-01-16 21:47:41 +01:00
|
|
|
use App\DBAL\Types\Meta\Right\LayerType;
|
|
|
|
use App\Exception\NoValidChoiceException;
|
|
|
|
|
2018-09-21 15:48:23 +02:00
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
|
|
|
trait LayerAttribut
|
|
|
|
{
|
|
|
|
/**
|
2019-01-16 21:47:41 +01:00
|
|
|
* @see LayerType
|
|
|
|
*
|
2018-09-21 15:48:23 +02:00
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $layer;
|
|
|
|
|
2019-01-16 21:47:41 +01:00
|
|
|
/**
|
|
|
|
* @param string $layer
|
|
|
|
*
|
|
|
|
* @throws NoValidChoiceException
|
|
|
|
*/
|
2018-09-21 15:48:23 +02:00
|
|
|
public function setLayer(string $layer): void
|
|
|
|
{
|
2019-01-16 21:47:41 +01:00
|
|
|
if (!array_key_exists($layer, LayerType::getChoices())) {
|
|
|
|
throw new NoValidChoiceException();
|
|
|
|
}
|
2018-09-21 15:48:23 +02:00
|
|
|
$this->layer = $layer;
|
|
|
|
}
|
|
|
|
|
2019-01-16 21:47:41 +01:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
2018-09-21 15:48:23 +02:00
|
|
|
public function getLayer(): string
|
|
|
|
{
|
|
|
|
return $this->layer;
|
|
|
|
}
|
|
|
|
}
|