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

fix various bugs around translation fallback #304

Merged
merged 1 commit into from
Aug 4, 2013
Merged

Conversation

dbu
Copy link
Member

@dbu 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;
Copy link
Member Author

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...

@wjzijderveld
Copy link
Contributor

Other then some coding standards that WouterJ already commented on, this seems fine to me.

@wjzijderveld
Copy link
Contributor

And the failing test caused by accessing private property should be fixed.

dbu added a commit that referenced this pull request Aug 4, 2013
fix various bugs around translation fallback
@dbu dbu merged commit 0d1999a into master Aug 4, 2013
@dbu dbu deleted the fix-translations branch August 4, 2013 10:25
// null, we want to just null them.
$allNullable = true;
foreach ($metadata->translatableFields as $fieldName) {
if (!$metadata->translatableFields[$fieldName]['nullable']) {
Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Member Author

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

@dantleech
Copy link
Contributor

@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...

@dantleech
Copy link
Contributor

Created #317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants