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

Allow for auto register Types #1246

Open
bigfoot90 opened this issue Nov 8, 2020 · 5 comments
Open

Allow for auto register Types #1246

bigfoot90 opened this issue Nov 8, 2020 · 5 comments

Comments

@bigfoot90
Copy link

With https://github.com/thunderer/Platenum we can use Enums in php, it also provide a Doctrine custom type witch maps to native ENUM mysql type.

I'm asking for the ability to automatically discovery and register custom types, as we are already doing for the entity mappings in our doctrine.yaml configuration files where we tell into which directories to look for.

@bigfoot90 bigfoot90 changed the title Allow for auto register Types from configured directories Allow for auto register Types Nov 8, 2020
@ostrolucky
Copy link
Member

ostrolucky commented Nov 8, 2020

Difference here is that discovery of entities in a namespace is handled by ORM, bundle just passes it over.

Considering types are not services, more appropriate place to ask for this feature might be DBAL. But if anyone wants to give this a try here, I'm not against that.

@bigfoot90
Copy link
Author

U're right, I'm closing this for the moment.

@ostrolucky
Copy link
Member

Actually, I was looking into this a bit and it should be possible to make types to be services. Then we would be able to tag these and inject everything tagged as such into dbal.

@ostrolucky ostrolucky reopened this Nov 12, 2020
@ste93cry
Copy link

I absolutely would like to see types as tagged services, this would enable a whole world of things that are now not possible, e.g. injecting custom services into the type to re-use logic, etc. Also, if we could get rid of that static singleton object that is the types registry it would be even cooler

@kbond
Copy link
Contributor

kbond commented Jul 20, 2022

@ostrolucky, if types can be services, how could we allow arguments if Type::__construct() cannot be overriden?

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

4 participants