Refactored DBAL Types

This commit is contained in:
Kevin Frantz 2019-01-05 16:40:47 +01:00
parent 23a4e1c679
commit f8e16180ba
8 changed files with 70 additions and 22 deletions

View File

@ -0,0 +1,31 @@
<?php
namespace App\DBAL\Types;
use Fresh\DoctrineEnumBundle\DBAL\Types\AbstractEnumType;
/**
* Containes all activated languages.
*
* @author kevinfrantz
*/
final class LanguageType extends AbstractEnumType
{
public const GERMAN = 'de';
public const ENGLISH = 'en';
public const DUTCH = 'nl';
public const SPANISH = 'es';
public const ESPERANTO = 'eo';
protected static $choices = [
self::GERMAN => 'German',
self::ENGLISH => 'English',
self::SPANISH => 'Spanish',
self::ESPERANTO => 'Esperanto',
self::DUTCH => 'Dutch',
];
}

View File

@ -8,6 +8,8 @@ use Fresh\DoctrineEnumBundle\DBAL\Types\AbstractEnumType;
* Not integrated in the db. Just used for mapping.
* May it will be helpfull for tracking ;).
*
* @deprecated this class doesn't make sense here. Find an other place for it
*
* @author kevinfrantz
*/
final class MenuEventType extends AbstractEnumType

View File

@ -0,0 +1,26 @@
<?php
namespace App\DBAL\Types\Meta\Right;
use Fresh\DoctrineEnumBundle\DBAL\Types\AbstractEnumType;
/**
* @author kevinfrantz
*/
final class CRUDType extends AbstractEnumType
{
public const CREATE = 'create';
public const READ = 'read';
public const UPDATE = 'update';
public const DELETE = 'delete';
protected static $choices = [
self::CREATE => 'create',
self::READ => 'read',
self::UPDATE => 'update',
self::DELETE => 'delete',
];
}

View File

@ -1,6 +1,6 @@
<?php
namespace App\DBAL\Types;
namespace App\DBAL\Types\Meta;
use Fresh\DoctrineEnumBundle\DBAL\Types\AbstractEnumType;
@ -15,6 +15,8 @@ final class LayerType extends AbstractEnumType
public const LAW = 'law';
public const MEMBER = 'member';
protected static $choices = [
self::RELATION => 'relation',
self::LAW => 'law',

View File

@ -9,14 +9,17 @@ use Fresh\DoctrineEnumBundle\DBAL\Types\AbstractEnumType;
*
* @author kevinfrantz
*/
final class TemplateType extends AbstractEnumType
final class RESTResponseType extends AbstractEnumType
{
public const JSON = 'json';
public const HTML = 'html';
public const XML = 'xml';
protected static $choices = [
self::JSON => 'json',
self::HTML => 'html',
self::XML => 'xml',
];
}

View File

@ -1,20 +0,0 @@
<?php
namespace App\DBAL\Types;
use Fresh\DoctrineEnumBundle\DBAL\Types\AbstractEnumType;
/**
* @author kevinfrantz
*/
final class RightType extends AbstractEnumType
{
public const READ = 'read';
public const WRITE = 'write';
protected static $choices = [
self::READ => 'read',
self::WRITE => 'write',
];
}

View File

@ -8,6 +8,10 @@ use Fresh\DoctrineEnumBundle\DBAL\Types\AbstractEnumType;
* Containes the system slugs.
*
* @author kevinfrantz
*
* @todo Organize this somehow on an other way
*
* @deprecated
*/
final class SystemSlugType extends AbstractEnumType
{