Implemented ActionTypeAttribut

This commit is contained in:
Kevin Frantz
2019-01-19 23:15:58 +01:00
parent 4b86acb372
commit 7e9916b27b
4 changed files with 108 additions and 2 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Entity\Attribut;
use App\Exception\NoValidChoiceException;
use App\DBAL\Types\ActionType;
/**
* @author kevinfrantz
*/
trait ActionTypeAttribut
{
/**
* @see ActionType
*
* @var string
*/
protected $actionType;
/**
* @param string $actionType
*/
public function setActionType(string $actionType): void
{
if (!array_key_exists($actionType, ActionType::getChoices())) {
throw new NoValidChoiceException('The type is not a valid action type.');
}
$this->actionType = $actionType;
}
/**
* @return string
*/
public function getActionType(): string
{
return $this->actionType;
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Entity\Attribut;
use App\DBAL\Types\ActionType;
/**
* @author kevinfrantz
*
* @see ActionType
*/
interface ActionTypeAttributInterface
{
/**
* @see ActionType
*
* @param string $actionType
*/
public function setActionType(string $actionType): void;
/**
* @see ActionType
*
* @return string
*/
public function getActionType(): string;
}

View File

@@ -6,8 +6,6 @@ use App\Exception\NoValidChoiceException;
use App\DBAL\Types\Meta\Right\CRUDType;
/**
* @todo Implement a trait for crud which substitute this one.
*
* @author kevinfrantz
*/
trait CrudAttribut