Access custom types in Mappings
catalinbuletin opened this issue · comments
Hello,
I am trying to use uuid
as primary keys in my database so i tried adding some custom types
Here is part of my doctrine config file:
'mapping_types' => [
'binary' => 'uuid_binary'
],
....
'custom_types' => [
'json' => LaravelDoctrine\ORM\Types\Json::class,
'uuid' => Ramsey\Uuid\Doctrine\UuidType::class,
'uuid_binary' => Ramsey\Uuid\Doctrine\UuidBinaryType::class,
],
In the Mapping I can't seem to be able to use either:
$builder->uuid('id')->primary();
$builder->uuid_binary('id')->primary();
this will result in
[InvalidArgumentException]
Fluent builder method [uuid] does not exist
[InvalidArgumentException]
Fluent builder method [uuid_binary] does not exist
Is it something i missed?
Thanks for your help!
Hi @catalinbuletin!
Custom types are not exposed through new magic methods. They can be used by giving the builder a reference of the new type as so:
$builder->field("uuid_binary", "id")->primary();
Awesome, thank you very much!