-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
fix various bugs around translation fallback #304
Conversation
dbu
commented
Aug 2, 2013
Q | A |
---|---|
Bug fix? | yes |
New feature? | no |
BC breaks? | in edge cases |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | - |
License | MIT |
Doc PR | only bugfix |
@@ -1233,7 +1233,7 @@ public function mapField(array $mapping, ClassMetadata $inherited = null) | |||
} | |||
|
|||
if (!isset($mapping['nullable'])) { | |||
$mapping['nullable'] = isset($parentMapping['nullable']) ? : false; | |||
$mapping['nullable'] = isset($parentMapping['nullable']) ? $parentMapping['nullable'] : false; |
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.
this was the reason why symfony-cmf/menu-bundle#115 helped in the sandbox. the return value of isset is true, regardless of what the field in $parentMapping is...
Other then some coding standards that WouterJ already commented on, this seems fine to me. |
And the failing test caused by accessing private property should be fixed. |
fix various bugs around translation fallback
// null, we want to just null them. | ||
$allNullable = true; | ||
foreach ($metadata->translatableFields as $fieldName) { | ||
if (!$metadata->translatableFields[$fieldName]['nullable']) { |
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.
This breaks my code, $metadata->translatableFields is just an array of strings,
see https://github.com/doctrine/phpcr-odm/blob/master/lib/Doctrine/ODM/PHPCR/Mapping/ClassMetadata.php#L1249, will try to provide a failing test
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.
argh. this should read !$metadata->mappings[$field]['nullable']
as in the attribute strategy above. no idea why i did not see that. maybe the tests in the end still do not cover all situations. would be great if you can add that test and then try if that fix is the correct one.
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.
ftr: uwe fixed this in #313
@dbu: This seems to be creating a regression at least when using the attribute translation strategy. I get an error message saying that it can't find any translations, reverting to the commit before this merge fixes the pb... |
Created #317 |