Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DibiLiteral annotation combined with string #87

Open
srigi opened this issue Jun 3, 2015 · 1 comment
Open

DibiLiteral annotation combined with string #87

srigi opened this issue Jun 3, 2015 · 1 comment

Comments

@srigi
Copy link

srigi commented Jun 3, 2015

I use PostgreSQL and UUID datatype.
To generate proper UUID you need to set annotation to

@property DibiLiteral $uuid

so resulting SQL looks like this:

INSERT INTO
  "public"."user"
  (uuid, email)
VALUES
  (uuid_generate_v4(), '[email protected]')

If I instead use string as datatype of property, INSERT fails cos uuid_generate_v4 function is wrapped in quotes in resulting SQL.

Problem with DibiLiteral annotation is when accessing $entity->uuid. Since property is annotated as DibiLiteral and DB in fact returns string, LeanMapper throws exeption. So I tried to use this form for annotation

@property string|DibiLiteral $uuid

This crashed EntityReflection at this exact point cos regex didn't matches anything.

Can you suggest any idea how to solve this. I don't want to give up on using Postgre's UUIDs.

@castamir castamir self-assigned this Feb 17, 2016
@castamir castamir added this to the v3.0 milestone Feb 21, 2016
@castamir
Copy link
Collaborator

I'd to define custom data types. This is a perfect use case. I started usingi sql server that has similar data types that do not have any corresponding ones in most of DBs (like GUID). And not just that. Decimal or kind of structed types might be defined this way in the future. But I move this issue to a lates release.

@castamir castamir removed this from the v3.0 milestone Feb 29, 2016
@janpecha janpecha added this to the Version 3.4.0 milestone Apr 23, 2018
@janpecha janpecha removed this from the Version 3.4.0 milestone Mar 16, 2019
@castamir castamir removed their assignment Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants