summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2014-09-13 12:15:24 +0200
committerRemi Collet <fedora@famillecollet.com>2014-09-13 12:15:24 +0200
commitc4c4af2d34823b3e05fadfc3584c932773110b3a (patch)
tree47a8689c322051ad08c45da72d807e848f4e7452
parentbd0a5155eab978c55a18859b64d4a78c6600641f (diff)
php-doctrine-orm: 2.4.4 (using doctrine/instanciator)
-rw-r--r--php-doctrine-orm-upstream.patch86
-rw-r--r--php-doctrine-orm.spec16
2 files changed, 76 insertions, 26 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'])
diff --git a/php-doctrine-orm.spec b/php-doctrine-orm.spec
index b3f67fd..ce9c37f 100644
--- a/php-doctrine-orm.spec
+++ b/php-doctrine-orm.spec
@@ -12,8 +12,8 @@
%global github_owner doctrine
%global github_name doctrine2
-%global github_version 2.4.2
-%global github_commit 0363a5548d9263f979f9ca149decb9cfc66419ab
+%global github_version 2.4.4
+%global github_commit fc19c3b53dcd00e6584db40669fdd699c4671f97
%global composer_vendor doctrine
%global composer_project orm
@@ -33,7 +33,7 @@
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
-Release: 4%{?dist}
+Release: 1%{?dist}
Summary: Doctrine Object-Relational-Mapper (ORM)
Group: Development/Libraries
@@ -47,6 +47,7 @@ Patch0: %{name}-bin.patch
# Upstream fix for latest PHP
Patch1: %{name}-upstream.patch
+Requires: php-composer(doctrine/instantiator) >= 1.0.2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@@ -136,12 +137,19 @@ rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
-%doc LICENSE *.md *.markdown composer.json
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc *.md *.markdown composer.json
%{_datadir}/php/Doctrine/ORM
%{_bindir}/doctrine
%changelog
+* Sat Sep 13 2014 Remi Collet <remi@fedoraproject.org> 2.4.4-1
+- Update to 2.4.4
+- backport upstream patch to use doctrine/instantiator
+- fix license handling
+
* Sat Jun 21 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.4.2-4
- Added php-composer(%%{composer_vendor}/%%{composer_project}) virtual provide
- Updated Doctrine dependencies to use php-composer virtual provides