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

Use cascade=all if all cascade options set #458

Merged
merged 4 commits into from
Oct 5, 2012
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/Doctrine/ORM/Tools/EntityGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,10 @@ private function generateAssociationMappingPropertyDocBlock(array $associationMa
if ($associationMapping['isCascadeMerge']) $cascades[] = '"merge"';
if ($associationMapping['isCascadeRefresh']) $cascades[] = '"refresh"';

if (count($cascades) === 5) {
$cascades = array('"all"');
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove trailing whitespaces

$typeOptions[] = 'cascade={' . implode(',', $cascades) . '}';
}

Expand Down
3 changes: 3 additions & 0 deletions lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ public function exportClassMetadata(ClassMetadataInfo $metadata)
unset($cascade[$key]);
}
}
if (count($cascade) === 5) {
$cascade = array('all');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an empty line before and after the if block

$associationMappingArray = array(
'fieldName' => $associationMapping['fieldName'],
'targetEntity' => $associationMapping['targetEntity'],
Expand Down