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

ValueObjects: Hard Coded Namespace for Entity Creation #2

Open
dreamingmind opened this issue Jul 7, 2021 · 0 comments
Open

ValueObjects: Hard Coded Namespace for Entity Creation #2

dreamingmind opened this issue Jul 7, 2021 · 0 comments

Comments

@dreamingmind
Copy link

ValueSource::_getSample() creates entity objects from an entity name. The namespace is added to the name for proper creation. This works, but for testing, the path to the entity object is different than the normal path and the namespace is different.

There are several solutions. Right now, I'm using an in-code testing switch:

Screen Shot 2021-07-06 at 8 37 57 PM

I'm looking for a 'best practices' solution.

One possibility; why is the TestApp namespaced in this particular way. Could it just as easily be namespaced as App\? Only if that particular namespace declaration never was made by the plugin during actual use. Not sure this is true.

Another possibility; is there an abstracted way I can look up the proper namespace? There are path constants but I don't know of any constant or method that can return a namespace.

Refactoring?

If the class did not allow passing a simple name but instead demanded a fully namespaced name the problem could go away. I'm not sure if this is practical. This is a valid call param but isn't currently used.

This interesting thing is, these ValueObjects are currently deep-internal objects that are not used outside the plugin. So we should be free to refactor this in any way that is convenient. I'm just not sure about how this is integrated into the overall code. I'm not even sure what this process is doing or whether it is truly necessary.

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

No branches or pull requests

1 participant