-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Remove final constructor for Type #6705
base: 4.3.x
Are you sure you want to change the base?
Remove final constructor for Type #6705
Conversation
Note: this is another take on #5528 |
I've never used custom types as besides schema management, they are primarily designed for the ORM. I'll defer to Alexander. |
If we do that, we turn |
How will it be a potential footgun? The current desired behavior is guarded, so I don't see how.
I agree, but that can be done independently from this PR, no? |
Yes, you've done all you could to give the developer proper feedback. Yet, we're about to create a class of types that cannot be registered with
Sure, but still we should talk about it. We somehow ended up with an only partially implemented feature and I want us to work towards a proper solution this time instead of adding a small hack on top to make it somewhat work. |
e6b5c83
to
355887c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the tests I wrote in my initial PR were not sufficient to prove it's possible to do what's in the documentation. Maybe they should be improved?
Co-authored-by: Grégoire Paris <[email protected]>
The docs should be updated, they mention |
Summary
This allows people to define a constructor when creating custom
Doctrine\DBAL\Types\Type
implementations.They can only be registered using
Type::getTypeRegistry()->register
and not withType::addType
.An extra guard in
Type::addType
explains this to the user.