Use cascade=all if all cascade options set #458

Merged
merged 4 commits into from Oct 5, 2012

3 participants

@carlos-granados

The YAML and XML metadata exporters output cascade=all if all five cascade options are set. The php and annotation exporter do not, they output cascade=list of all 5 cascades instead.

In order that all 4 exporters offer the same behavior, I updated the php and annotations exporters so that they export cascade=all

@doctrinebot

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DDC-2049

@stof stof commented on an outdated diff Oct 1, 2012
lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php
@@ -99,6 +99,9 @@ public function exportClassMetadata(ClassMetadataInfo $metadata)
unset($cascade[$key]);
}
}
+ if (count($cascade) === 5) {
+ $cascade = array('all');
+ }
@stof
Doctrine member
stof added a line comment Oct 1, 2012

Please add an empty line before and after the if block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@stof stof commented on an outdated diff Oct 1, 2012
lib/Doctrine/ORM/Tools/EntityGenerator.php
@@ -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"');
+ }
+
@stof
Doctrine member
stof added a line comment Oct 1, 2012

Please remove trailing whitespaces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@carlos-granados

Added empty lines around if block and removed trailing whitespace

@beberlei beberlei merged commit 0c8be37 into doctrine:master Oct 5, 2012

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment