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

chore: make class non-final #297

Merged
merged 1 commit into from
Jan 27, 2022
Merged

chore: make class non-final #297

merged 1 commit into from
Jan 27, 2022

Conversation

DevinCodes
Copy link
Contributor

Q A
Bug fix? no
New feature? no
BC breaks? no
Related Issue Fix #293

Describe your change

This removes the final keyword from the ObjectEncrypter class, so its behavior can be customized. Please note that we don't provide support when you decide to override this class.

@DevinCodes DevinCodes requested a review from damcou January 27, 2022 14:20
Copy link

@damcou damcou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@DevinCodes DevinCodes merged commit cdaa634 into master Jan 27, 2022
@DevinCodes DevinCodes deleted the fix/objectID-encrypt branch January 27, 2022 14:41
@mattdfloyd
Copy link

It would seem that for this change to be really beneficial that the ObjectEncrypter would need to be resolved from the container. As is, extending this class doesn't have much benefit unless you also reimplement anywhere the class is called. If the ObjectEncrypter was resolved out of the container each time it is used, the developer would have full control over the functionality. In the end, this really may not be what is desired though.

Alternatively, another solution to possibly solve #293, and my use case, would be allowing the first part of the encrypted ObjectID to be configured. This way the developer nearly have full control of how the ObjectID is constructed.

This has a similar feel to me to how Laravel can configure morph maps to decouple values from their implementation. In the same way, we'd almost certainly need a map available at a global level so that decryption of the ObjectID and the Searhable model resolution could still work.

For my use case, I am looking into how to prevent the ObjectID from changing should the Model name ever change. Currently, if App\Models\Auto was renamed to App\Models\Automobile all analytics (I assume) would be lost for those search objects as the ObjectId would change from App\Models\Auto::1 to App\Models\Automobile::1.

@LoganTFox
Copy link

+1

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

Successfully merging this pull request may close these issues.

Should allow to change full objectId
4 participants