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

Mapper relations fail when primary keys are binary #285

Open
Peace-N opened this issue Jan 17, 2019 · 5 comments
Open

Mapper relations fail when primary keys are binary #285

Peace-N opened this issue Jan 17, 2019 · 5 comments

Comments

@Peace-N
Copy link

Peace-N commented Jan 17, 2019

We are currently facing a challenge here, we are using custom types that we have registered with Dbal and the types are uuid_binary_ordered_time, the Mapper relations fail when primary keys are binary and stored in this type, infact it actually ignores.

We have tested with primary keys as strings and integeres and relations work fine. Has anyone of you ever tried this ?

@FlipEverything
Copy link
Contributor

As said before (#197), you should use a numeric primary key with Spot.... It doesn't hurt....

Personally I think that would be opening a can of worms. Easy and working solution is just to use add numeric primary key as Spot requires. Primary keys are not supposed to contain any business logic anyway. You cannot cater to everyone.

Also Spot requires a primary key that is numeric because there are some "is_numeric()" checks for Mapper::get(), Mapper::delete() and so on.

@Peace-N
Copy link
Author

Peace-N commented Jan 24, 2019

Thank you for your Feedback, can this be a feature request ?

@FlipEverything
Copy link
Contributor

It sure can be, but I don't think that's a priority for us right now.

@Peace-N
Copy link
Author

Peace-N commented Apr 2, 2019

I will have to add this on to the ORM and create a pull request . Have made it work out of its box .

@vlucas
Copy link
Collaborator

vlucas commented Aug 15, 2019

I have not tried this, but it seems like it should be possible and a supported use case for Spot. UUIDs are valid identifiers, and are commonly used in distributed systems instead of auto-incremented ids. Can you do some digging on this @Peace-N and maybe submit a PR with the code required to support it? I don't have any system configured like this to test with.

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