-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Feature/doctrine type guesser simple json array support #24297
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
Feature/doctrine type guesser simple json array support #24297
Conversation
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.
Is this "technical BC break" really important? We could aso consider it a missing feature or bug: Doctrine DBAL will keep adding new methods and we need to update our guessers.
Maybe some Doctrine experts could point to more potential issues caused by this change? Thanks!
The |
The docs are wrong here, the code (https://github.com/doctrine/dbal/blob/2.5/lib/Doctrine/DBAL/Types/JsonArrayType.php#L63) shows that any non-null (database null, you can still get a null result with a json containing And The |
@jvasseur Point taken. To be fair, the guesser uses |
f755bb4
to
958a8b2
Compare
Moving to 4.1. Rebase on master might be needed, where PHP 7.1 features can be used btw. |
958a8b2
to
c08426b
Compare
@nicolas-grekas Done. When will the 4.0 branch be created? |
c08426b
to
25060b4
Compare
Branch 4.0 will be created a few days before its release, so end of november. |
@nicolas-grekas Ok! 👍 |
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.
JsonArray is deprecated since dbal 2.6 (https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Types/JsonArrayType.php#L28). So there is no point in adding support for it as a new feature. Also it's not safe anyway. The value is usually an array, but you can also encode scalar values as json which then does not return an array.
So the PR should be changed to only add support for simple_array.
@@ -53,6 +53,8 @@ public function guessType($class, $property) | |||
|
|||
switch ($metadata->getTypeOfField($property)) { | |||
case Type::TARRAY: | |||
case Type::SIMPLE_ARRAY: | |||
case Type::JSON_ARRAY: |
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.
Can you remove JSON_ARRAY
so that we can merge this PR?
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.
Done.
25060b4
to
8c7fbe9
Compare
8c7fbe9
to
00a72ad
Compare
Removed support for |
00a72ad
to
524bc4b
Compare
Thank you @iluuu1994. |
…t (iluuu1994) This PR was squashed before being merged into the 4.2-dev branch (closes #24297). Discussion ---------- Feature/doctrine type guesser simple json array support Symfony currently supports doctrine/dbal ~2.4 which has support for both `simple_array` and `json_array`: doctrine/dbal@44cd77f doctrine/dbal@2d183ac | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - There's technically a small BC break since `simple_array` and `json_array` fields would've been displayed as simple text fields. Is this an acceptable BC break for Symfony 3.4? Commits ------- 524bc4b Feature/doctrine type guesser simple json array support
Symfony currently supports doctrine/dbal ~2.4 which has support for both
simple_array
andjson_array
:doctrine/dbal@44cd77f
doctrine/dbal@2d183ac
There's technically a small BC break since
simple_array
andjson_array
fields would've been displayed as simple text fields. Is this an acceptable BC break for Symfony 3.4?