mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Implemented ActionTypeAttribut
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
@@ -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
|
||||
|
Reference in New Issue
Block a user