mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-10 22:37:28 +01:00
39 lines
625 B
PHP
39 lines
625 B
PHP
<?php
|
|
|
|
namespace App\Attribut;
|
|
|
|
use App\Exception\NoValidChoiceException;
|
|
use App\DBAL\Types\Meta\Right\CRUDType;
|
|
|
|
/**
|
|
* @author kevinfrantz
|
|
*/
|
|
trait CrudAttribut
|
|
{
|
|
/**
|
|
* @see CRUDType
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $crud;
|
|
|
|
/**
|
|
* @param string $crud
|
|
*/
|
|
public function setCrud(string $crud): void
|
|
{
|
|
if (!array_key_exists($crud, CRUDType::getChoices())) {
|
|
throw new NoValidChoiceException();
|
|
}
|
|
$this->crud = $crud;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getCrud(): string
|
|
{
|
|
return $this->crud;
|
|
}
|
|
}
|