-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix type guesser. Ignore field MappingException. #458
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.
@BoShurik thanks a lot for the PR! Could you please add a test to prevent regression in the future?
Form/DoctrineMongoDBTypeGuesser.php
Outdated
@@ -49,6 +49,10 @@ public function guessType($class, $property) | |||
|
|||
list($metadata, $name) = $ret; | |||
|
|||
if (!$metadata->hasField($property)) { |
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.
Please add a space after !
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.
@malarzm Done. But in code there are only 3 places with such style. And 22 without spaces
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.
Ah so the bundle did not receive CS fixes yet, thank you :)
Form/DoctrineMongoDBTypeGuesser.php
Outdated
@@ -49,6 +49,10 @@ public function guessType($class, $property) | |||
|
|||
list($metadata, $name) = $ret; | |||
|
|||
if (! $metadata->hasField($property)) { | |||
return new TypeGuess($this->typeFQCN ? TextType::class : 'text', [], Guess::LOW_CONFIDENCE); |
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.
Now I saw the test I'm wondering whether guessing TextType
(even with low confidence) is correct. From what I saw in https://symfony.com/doc/current/form/type_guesser.html it's possible to just return;
if we can't (or shouldn't) make a guess at all. Do you think it'd be more appropiate?
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.
I copy behaviour from a symfony/doctrine-bridge. Looks like in the first versions guessType
returns only TypeGuess
instance (based on phpDoc). I think now we can return nulls
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.
@malarzm Do you want me to change it?
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.
Yes, please
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.
Also if you could squash commits later that'd be awesome :)
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
@malarzm ping! Is there any other things that prevent merging? |
Sorry, had this email starred but did not get back to it in time. Looks good to me! @alcaeus are we couting this as a bugfix and releasing 3.4.3 or will this wait for 3.5.0? |
FWIW I'm fine with relasing 3.4.3 with this fix only as we do not get that many issues to fix. |
Bugfix it is. |
@BoShurik enjoy 3.4.3 ;) |
Fix errors like "No mapping found for field 'plainPassword' in class 'App\Document\Administrator'."