Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Accessors for non-primary-key UUID fields #33

Closed
westphalen opened this issue Jan 18, 2018 · 3 comments
Closed

Accessors for non-primary-key UUID fields #33

westphalen opened this issue Jan 18, 2018 · 3 comments

Comments

@westphalen
Copy link

The HasBinaryUuid trait seems to forcefully convert the primary key to its text representation during toArray. Even if this was the wanted behavior, any other UUID fields are left on their own. For example, a "belongs to" scenario, where a user_id or user_uuid binary UUID exists, nothing is done to convert that field to text. That leads to unclear exceptions due to json_decode failing for the binary field.

For consistency, the primary key should probably not forcefully be converted to text. Instead we could add something like public $uuidFields = ['id', 'user_id']; to the models. A default value for $uuidFields could take care of the automatic conversion of the primary key, while the user may set $uuidFields = [] to disable that behavior.

@brendt
Copy link
Contributor

brendt commented Jan 18, 2018

Let's further discuss this in PR #35 👍

@brendt brendt closed this as completed Jan 18, 2018
@choma
Copy link

choma commented May 11, 2018

I guess this should be reopened since the PR was abandoned, and this would be a nice feature

@brendt
Copy link
Contributor

brendt commented May 14, 2018

No need, the PR is still open, and I will look further into it when there's time. Unfortunately, I don't think I'll be able to give it attention anytime soon, so if you're up for it: feel free to fork the existing PR and submit it new one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants