summaryrefslogtreecommitdiffstats
path: root/php-doctrine-orm-upstream.patch
diff options
context:
space:
mode:
Diffstat (limited to 'php-doctrine-orm-upstream.patch')
-rw-r--r--php-doctrine-orm-upstream.patch86
1 files changed, 64 insertions, 22 deletions
diff --git a/php-doctrine-orm-upstream.patch b/php-doctrine-orm-upstream.patch
index 4754af4..c8d6170 100644
--- a/php-doctrine-orm-upstream.patch
+++ b/php-doctrine-orm-upstream.patch
@@ -1,31 +1,73 @@
-From 93c276d059b40b0783ba9a24549a8b135e257693 Mon Sep 17 00:00:00 2001
-From: Renaud LITTOLFF <renaud@atipik.fr>
-Date: Fri, 30 May 2014 10:43:11 +0200
-Subject: [PATCH] Fix the "Erroneous data format for unserializing" error
- message
+Adapted for 2.4 from:
+
+From 361ec2a474d78168473fb82a041f32c4b7665643 Mon Sep 17 00:00:00 2001
+From: Marco Pivetta <ocramius@gmail.com>
+Date: Thu, 14 Aug 2014 15:51:48 +0200
+Subject: [PATCH] DDC-3120 - using `Doctrine\Instantiator` when building new
+ instances
---
- lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
+ lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php | 21 +++++++--------------
+ 1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
-index ba7a2d2..5fe8587 100644
+index 5d36f64..f8b4bb7 100644
--- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
+++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
-@@ -908,7 +908,12 @@ public function __sleep()
+@@ -20,6 +20,7 @@
+ namespace Doctrine\ORM\Mapping;
+
+ use BadMethodCallException;
++use Doctrine\Instantiator\Instantiator;
+ use InvalidArgumentException;
+ use RuntimeException;
+ use Doctrine\DBAL\Types\Type;
+@@ -610,11 +611,9 @@ class ClassMetadataInfo implements Class
+ public $reflFields = array();
+
+ /**
+- * The prototype from which new instances of the mapped class are created.
+- *
+- * @var object
++ * @var \Doctrine\Instantiator\InstantiatorInterface|null
+ */
+- private $_prototype;
++ private $instantiator;
+
+ /**
+ * Initializes a new ClassMetadata instance that will hold the object-relational mapping
+@@ -628,6 +627,7 @@ class ClassMetadataInfo implements Class
+ $this->name = $entityName;
+ $this->rootEntityName = $entityName;
+ $this->namingStrategy = $namingStrategy ?: new DefaultNamingStrategy();
++ $this->instantiator = new Instantiator();
+ }
+
+ /**
+@@ -865,15 +865,7 @@ class ClassMetadataInfo implements Class
+ */
public function newInstance()
{
- if ($this->_prototype === null) {
-- $this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
-+ if (version_compare(PHP_VERSION, '5.4') >= 0) {
-+ $rc = new \ReflectionClass($this->name);
-+ $this->_prototype = $rc->newInstanceWithoutConstructor();
-+ } else {
-+ $this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
-+ }
- }
+- if ($this->_prototype === null) {
+- if (PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513) {
+- $this->_prototype = $this->reflClass->newInstanceWithoutConstructor();
+- } else {
+- $this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
+- }
+- }
+-
+- return clone $this->_prototype;
++ return $this->instantiator->instantiate($this->name);
+ }
+ /**
+ * Restores some state that can not be serialized/unserialized.
+@@ -885,7 +877,8 @@ class ClassMetadataInfo implements Class
+ public function wakeupReflection($reflService)
+ {
+ // Restore ReflectionClass and properties
+- $this->reflClass = $reflService->getClass($this->name);
++ $this->reflClass = $reflService->getClass($this->name);
++ $this->instantiator = $this->instantiator ?: new Instantiator();
- return clone $this->_prototype;
---
-1.9.3
-
+ foreach ($this->fieldMappings as $field => $mapping) {
+ $this->reflFields[$field] = isset($mapping['declared'])