Implemented getChoices and getValues from Doctrine ENUM on the right way

This commit is contained in:
Kevin Frantz
2019-02-25 13:32:37 +01:00
parent 0bf7554afb
commit 90df65828c
21 changed files with 29 additions and 29 deletions

View File

@@ -22,7 +22,7 @@ trait ActionTypeAttribut
*/
public function setActionType(string $actionType): void
{
if (!array_key_exists($actionType, ActionType::getChoices())) {
if (!in_array($actionType, ActionType::getValues())) {
throw new NoValidChoiceException('The type is not a valid action type.');
}
$this->actionType = $actionType;

View File

@@ -22,7 +22,7 @@ trait CrudAttribut
*/
public function setCrud(string $crud): void
{
if (!array_key_exists($crud, CRUDType::getChoices())) {
if (!in_array($crud, CRUDType::getValues())) {
throw new NoValidChoiceException();
}
$this->crud = $crud;

View File

@@ -26,7 +26,7 @@ trait LayerAttribut
*/
public function setLayer(string $layer): void
{
if (!array_key_exists($layer, LayerType::getChoices())) {
if (!in_array($layer, LayerType::getValues())) {
throw new NoValidChoiceException("'$layer' is not a correct layer type.");
}
$this->layer = $layer;