You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the introduction of Doctrine 2.14, we can now create our own TypedFieldMapper implementation.
This will allow us to replace
#[ORM\Entity]
class Card
{
#[ORM\Column(Suit::class)]
protectedSuit$suit;
}
with
#[ORM\Entity]
class Card
{
#[ORM\Column]
protectedSuit$suit;
}
I propose we create our own that will check if the enum is specified in types list
elao_enum:
doctrine:
types:
App\Enum\Suit: ~ # Defaults to `{ class: App\Enum\Suit, default: null, type: single }`permissions: { class: App\Enum\Permission } # You can set a name different from the enum FQCNpermissions_bag: { class: App\Enum\Permissions, type: flagbag } # values are stored as an int and retrieved as FlagBag objectApp\Enum\RequestStatus: { default: 200 } # Default value from enum cases, in case the db value is NULLprepend_typed_field_mapper: true #default false
If elao_enum.doctrine.types.prepend_typed_field_mapper is set to true (maybe we can make this a default?) then I would inject our typed field mapper into doctrine config. The way to do this would be:
With the introduction of Doctrine 2.14, we can now create our own
TypedFieldMapper
implementation.This will allow us to replace
with
I propose we create our own that will check if the enum is specified in types list
If
elao_enum.doctrine.types.prepend_typed_field_mapper
is set to true (maybe we can make this a default?) then I would inject our typed field mapper into doctrine config. The way to do this would be:This will ensure that the already used typed field mapper is kept, and
ElaoTypedFieldMapper
will only take care of the elao enum types.The actual typed field mapper is simple, can look sth like this:
The text was updated successfully, but these errors were encountered: