Skip to content

Commit 67d800a

Browse files
authored
Merge pull request #6719 from Ocramius/cleanup/replace-proxy-factory
Replace proxy layer with ProxyManager's layer
2 parents 7f14a90 + da7383b commit 67d800a

File tree

132 files changed

+2123
-3090
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+2123
-3090
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ lib/Doctrine/DBAL
1414
vendor/
1515
composer.lock
1616
/tests/Doctrine/Performance/history.db
17+
phpbench.phar
18+
phpbench.phar.pubkey

UPGRADE.md

+44
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,49 @@
11
# Upgrade to 3.0
22

3+
## BC Break: proxies no longer implement `Doctrine\ORM\Proxy\Proxy`
4+
5+
Proxy objects no longer implement `Doctrine\ORM\Proxy\Proxy` nor
6+
`Doctrine\Common\Persistence\Proxy`: instead, they implement
7+
`ProxyManager\Proxy\GhostObjectInterface`.
8+
9+
These related classes have been removed:
10+
11+
* `Doctrine\ORM\Proxy\ProxyFactory` - replaced by `Doctrine\ORM\Proxy\Factory\StaticProxyFacory`
12+
and `Doctrine\ORM\Proxy\Factory\ProxyFactory`
13+
* `Doctrine\ORM\Proxy\Proxy`
14+
* `Doctrine\ORM\Proxy\Autoloader` - we suggest using the composer autoloader instead
15+
* `Doctrine\ORM\Reflection\RuntimePublicReflectionProperty`
16+
17+
These methods have been removed:
18+
19+
* `Doctrine\ORM\Configuration#getProxyDir()`
20+
* `Doctrine\ORM\Configuration#getAutoGenerateProxyClasses()`
21+
* `Doctrine\ORM\Configuration#getProxyNamespace()`
22+
23+
Proxy class names change: the generated proxies now follow
24+
the [`ClassNameInflector`](https://github.com/Ocramius/ProxyManager/blob/2.1.1/src/ProxyManager/Inflector/ClassNameInflector.php)
25+
naming.
26+
27+
Proxies are also always generated if not found: fatal errors due to missing
28+
proxy classes should no longer occur with ORM default settings.
29+
30+
In addition to that, following changes affect entity lazy-loading semantics:
31+
32+
* `final` methods are now allowed
33+
* `__clone` is no longer called by the ORM
34+
* `__wakeup` is no longer called by the ORM
35+
* `serialize($proxy)` will lead to full recursive proxy initialization: please mitigate
36+
the recursive initialization by implementing
37+
the [`Serializable`](https://secure.php.net/manual/en/class.serializable.php) interface
38+
* `clone $proxy` will lead to full initialization of the cloned instance, not the
39+
original instance
40+
* lazy-loading a detached proxy no longer causes the proxy identifiers to be reset
41+
to `null`
42+
* identifier properties are always set when the ORM produces a proxy instance
43+
* calling a method on a proxy no longer causes proxy lazy-loading if the method does
44+
not access any un-initialized proxy state
45+
* accessing entity private state, even with reflection, will trigger lazy-loading
46+
347
## BC Break: Removed `Doctrine\ORM\Version`
448

549
The `Doctrine\ORM\Version` class is no longer available: please refrain from checking the ORM version at runtime.

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"doctrine/cache": "~1.6",
2424
"doctrine/annotations": "~1.4",
2525
"ocramius/package-versions": "^1.1.2",
26+
"ocramius/proxy-manager": "^2.1.1",
2627
"symfony/console": "~3.0|~4.0"
2728
},
2829
"require-dev": {

docs/en/cookbook/implementing-wakeup-or-clone.rst

-78
This file was deleted.

docs/en/cookbook/integrating-with-codeigniter.rst

+2-8
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ Customize it to your needs.
6868
$doctrineClassLoader->register();
6969
$entitiesClassLoader = new ClassLoader('models', rtrim(APPPATH, "/" ));
7070
$entitiesClassLoader->register();
71-
$proxiesClassLoader = new ClassLoader('Proxies', APPPATH.'models/proxies');
72-
$proxiesClassLoader->register();
7371
7472
// Set up caches
7573
$config = new Configuration;
@@ -80,17 +78,13 @@ Customize it to your needs.
8078
$config->setQueryCacheImpl($cache);
8179
8280
$config->setQueryCacheImpl($cache);
83-
84-
// Proxy configuration
81+
8582
$config->setProxyDir(APPPATH.'/models/proxies');
86-
$config->setProxyNamespace('Proxies');
8783
8884
// Set up logger
8985
$logger = new EchoSQLLogger;
9086
$config->setSQLLogger($logger);
9187
92-
$config->setAutoGenerateProxyClasses( TRUE );
93-
9488
// Database connection information
9589
$connectionOptions = array(
9690
'driver' => 'pdo_mysql',
@@ -108,7 +102,7 @@ Customize it to your needs.
108102
Please note that this is a development configuration; for a
109103
production system you'll want to use a real caching system like
110104
APC, get rid of EchoSqlLogger, and turn off
111-
autoGenerateProxyClasses.
105+
proxy auto-generation.
112106

113107
For more details, consult the
114108
`Doctrine 2 Configuration documentation <http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/configuration.html>`_.

docs/en/index.rst

-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ Cookbook
112112
* **Implementation**:
113113
:doc:`Array Access <cookbook/implementing-arrayaccess-for-domain-objects>` |
114114
:doc:`Notify ChangeTracking Example <cookbook/implementing-the-notify-changetracking-policy>` |
115-
:doc:`Using Wakeup Or Clone <cookbook/implementing-wakeup-or-clone>` |
116115
:doc:`Working with DateTime <cookbook/working-with-datetime>` |
117116
:doc:`Validation <cookbook/validation-of-entities>` |
118117
:doc:`Entities in the Session <cookbook/entities-in-session>` |

0 commit comments

Comments
 (0)