From c97eff94f56929238ace052af4b5e77df93c9317 Mon Sep 17 00:00:00 2001 From: barelon Date: Sun, 30 Sep 2012 01:12:06 +0300 Subject: [PATCH 1/4] Output cascade={"all"} if all cascade options set --- lib/Doctrine/ORM/Tools/EntityGenerator.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index 3e20ee5f7..542bb3f0a 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -1045,6 +1045,10 @@ public function __construct() if ($associationMapping['isCascadeMerge']) $cascades[] = '"merge"'; if ($associationMapping['isCascadeRefresh']) $cascades[] = '"refresh"'; + if (count($cascades) === 5) { + $cascades = array('"all"'); + } + $typeOptions[] = 'cascade={' . implode(',', $cascades) . '}'; } From cd37ec47d55dd5d8300e8cb8a2c8fb1ea120bc7f Mon Sep 17 00:00:00 2001 From: barelon Date: Sun, 30 Sep 2012 01:16:21 +0300 Subject: [PATCH 2/4] Set 'cascade' => 'all' if all cascade options set --- lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php index 24f72431e..50236fd12 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php @@ -99,6 +99,9 @@ class PhpExporter extends AbstractExporter unset($cascade[$key]); } } + if (count($cascade) === 5) { + $cascade = array('all'); + } $associationMappingArray = array( 'fieldName' => $associationMapping['fieldName'], 'targetEntity' => $associationMapping['targetEntity'], From 3b27216c5153b962a4436b0549c8c59986e0483e Mon Sep 17 00:00:00 2001 From: barelon Date: Tue, 2 Oct 2012 00:14:24 +0300 Subject: [PATCH 3/4] add empty lines around if block --- lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php index 50236fd12..d2c26d7ee 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php @@ -99,9 +99,11 @@ class PhpExporter extends AbstractExporter unset($cascade[$key]); } } + if (count($cascade) === 5) { $cascade = array('all'); } + $associationMappingArray = array( 'fieldName' => $associationMapping['fieldName'], 'targetEntity' => $associationMapping['targetEntity'], From 919cf8558ba0170025132108c2f9da36612f5860 Mon Sep 17 00:00:00 2001 From: barelon Date: Tue, 2 Oct 2012 00:16:29 +0300 Subject: [PATCH 4/4] Remove trailing whitespace --- lib/Doctrine/ORM/Tools/EntityGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index 542bb3f0a..905de215b 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -1048,7 +1048,7 @@ public function __construct() if (count($cascades) === 5) { $cascades = array('"all"'); } - + $typeOptions[] = 'cascade={' . implode(',', $cascades) . '}'; }