Optimized layer attribut

This commit is contained in:
Kevin Frantz
2019-01-16 21:47:41 +01:00
parent 6897b44aec
commit 1651ff95f7
4 changed files with 31 additions and 25 deletions

View File

@@ -2,21 +2,37 @@
namespace App\Entity\Attribut;
use App\DBAL\Types\Meta\Right\LayerType;
use App\Exception\NoValidChoiceException;
/**
* @author kevinfrantz
*/
trait LayerAttribut
{
/**
* @see LayerType
*
* @var string
*/
protected $layer;
/**
* @param string $layer
*
* @throws NoValidChoiceException
*/
public function setLayer(string $layer): void
{
if (!array_key_exists($layer, LayerType::getChoices())) {
throw new NoValidChoiceException();
}
$this->layer = $layer;
}
/**
* @return string
*/
public function getLayer(): string
{
return $this->layer;