Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d4bbac0

Browse files
Deprecate Doctrine\ORM\Proxy\Proxy and decouple a bit more from Doctrine\Common\Proxy
1 parent 7a9037e commit d4bbac0

45 files changed

Lines changed: 76 additions & 66 deletions

Some content is hidden

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

UPGRADE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Upgrade to 2.14
2+
3+
## Deprecated `Doctrine\ORM\Proxy\Proxy` interface.
4+
5+
Use `Doctrine\Persistence\Proxy` instead to check whether proxies are initialized.
6+
17
# Upgrade to 2.13
28

39
## Deprecated `QueryBuilder` methods and constants.

docs/en/cookbook/accessing-private-properties-of-the-same-class-from-different-instance.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ the proxy before use manually as follows:
2323
2424
<?php
2525
26-
use Doctrine\Common\Proxy\Proxy;
26+
use Doctrine\Persistence\Proxy;
2727
use Doctrine\ORM\Mapping as ORM;
2828
2929
/**

docs/en/reference/advanced-configuration.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ option that controls this behavior is:
214214
215215
Possible values for ``$mode`` are:
216216

217-
- ``Doctrine\Common\Proxy\AbstractProxyFactory::AUTOGENERATE_NEVER``
217+
- ``Doctrine\ORM\Proxy\ProxyFactory::AUTOGENERATE_NEVER``
218218

219219
Never autogenerate a proxy. You will need to generate the proxies
220220
manually, for this use the Doctrine Console like so:
@@ -230,17 +230,17 @@ methods were added to the entity class that are not yet in the proxy class.
230230
In such a case, simply use the Doctrine Console to (re)generate the
231231
proxy classes.
232232

233-
- ``Doctrine\Common\Proxy\AbstractProxyFactory::AUTOGENERATE_ALWAYS``
233+
- ``Doctrine\ORM\Proxy\ProxyFactory::AUTOGENERATE_ALWAYS``
234234

235235
Always generates a new proxy in every request and writes it to disk.
236236

237-
- ``Doctrine\Common\Proxy\AbstractProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS``
237+
- ``Doctrine\ORM\Proxy\ProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS``
238238

239239
Generate the proxy class when the proxy file does not exist.
240240
This strategy causes a file exists call whenever any proxy is
241241
used the first time in a request.
242242

243-
- ``Doctrine\Common\Proxy\AbstractProxyFactory::AUTOGENERATE_EVAL``
243+
- ``Doctrine\ORM\Proxy\ProxyFactory::AUTOGENERATE_EVAL``
244244

245245
Generate the proxy classes and evaluate them on the fly via eval(),
246246
avoiding writing the proxies to disk.

docs/en/reference/unitofwork.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ will still end up with the same reference:
3838
{
3939
$objectA = $this->entityManager->getReference('EntityName', 1);
4040
// check for proxyinterface
41-
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $objectA);
41+
$this->assertInstanceOf('Doctrine\Persistence\Proxy', $objectA);
4242
4343
$objectB = $this->entityManager->find('EntityName', 1);
4444

docs/en/tutorials/getting-started.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@ Directory, it looks like:
15261526
/**
15271527
* THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
15281528
**/
1529-
class UserProxy extends \User implements \Doctrine\ORM\Proxy\Proxy
1529+
class UserProxy extends \User // ..
15301530
{
15311531
// .. lazy load code here
15321532

lib/Doctrine/ORM/Cache/DefaultQueryCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Doctrine\ORM\Cache;
66

77
use Doctrine\Common\Collections\ArrayCollection;
8-
use Doctrine\Common\Proxy\Proxy;
98
use Doctrine\ORM\Cache;
109
use Doctrine\ORM\Cache\Exception\FeatureNotImplemented;
1110
use Doctrine\ORM\Cache\Exception\NonCacheableEntity;
@@ -17,6 +16,7 @@
1716
use Doctrine\ORM\Query;
1817
use Doctrine\ORM\Query\ResultSetMapping;
1918
use Doctrine\ORM\UnitOfWork;
19+
use Doctrine\Persistence\Proxy;
2020

2121
use function array_map;
2222
use function array_shift;

lib/Doctrine/ORM/Configuration.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Doctrine\Common\Cache\Psr6\CacheAdapter;
1414
use Doctrine\Common\Cache\Psr6\DoctrineProvider;
1515
use Doctrine\Common\Persistence\PersistentObject;
16-
use Doctrine\Common\Proxy\AbstractProxyFactory;
1716
use Doctrine\Deprecations\Deprecation;
1817
use Doctrine\ORM\Cache\CacheConfiguration;
1918
use Doctrine\ORM\Cache\Exception\CacheException;
@@ -92,18 +91,18 @@ public function getProxyDir()
9291
/**
9392
* Gets the strategy for automatically generating proxy classes.
9493
*
95-
* @return int Possible values are constants of Doctrine\Common\Proxy\AbstractProxyFactory.
94+
* @return int Possible values are constants of Doctrine\ORM\Proxy\ProxyFactory.
9695
* @psalm-return AutogenerateMode
9796
*/
9897
public function getAutoGenerateProxyClasses()
9998
{
100-
return $this->_attributes['autoGenerateProxyClasses'] ?? AbstractProxyFactory::AUTOGENERATE_ALWAYS;
99+
return $this->_attributes['autoGenerateProxyClasses'] ?? ProxyFactory::AUTOGENERATE_ALWAYS;
101100
}
102101

103102
/**
104103
* Sets the strategy for automatically generating proxy classes.
105104
*
106-
* @param bool|int $autoGenerate Possible values are constants of Doctrine\Common\Proxy\AbstractProxyFactory.
105+
* @param bool|int $autoGenerate Possible values are constants of Doctrine\ORM\Proxy\ProxyFactory.
107106
* @psalm-param bool|AutogenerateMode $autoGenerate
108107
* True is converted to AUTOGENERATE_ALWAYS, false to AUTOGENERATE_NEVER.
109108
*
@@ -572,7 +571,7 @@ public function ensureProductionSettings()
572571
throw QueryCacheUsesNonPersistentCache::fromDriver($queryCacheImpl);
573572
}
574573

575-
if ($this->getAutoGenerateProxyClasses() !== AbstractProxyFactory::AUTOGENERATE_NEVER) {
574+
if ($this->getAutoGenerateProxyClasses() !== ProxyFactory::AUTOGENERATE_NEVER) {
576575
throw ProxyClassesAlwaysRegenerating::create();
577576
}
578577

lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
namespace Doctrine\ORM\Internal\Hydration;
66

77
use Doctrine\Common\Collections\ArrayCollection;
8-
use Doctrine\Common\Proxy\Proxy;
98
use Doctrine\ORM\Mapping\ClassMetadata;
109
use Doctrine\ORM\PersistentCollection;
1110
use Doctrine\ORM\Query;
1211
use Doctrine\ORM\UnitOfWork;
12+
use Doctrine\Persistence\Proxy;
1313

1414
use function array_fill_keys;
1515
use function array_keys;

lib/Doctrine/ORM/Proxy/Proxy.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
/**
1010
* Interface for proxy classes.
11+
*
12+
* @deprecated 2.14. Use \Doctrine\Persistence\Proxy instead
1113
*/
1214
interface Proxy extends BaseProxy
1315
{

lib/Doctrine/ORM/Proxy/ProxyFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/**
2121
* This factory is used to create proxy objects for entities at runtime.
2222
*
23-
* @psalm-type AutogenerateMode = AbstractProxyFactory::AUTOGENERATE_NEVER|AbstractProxyFactory::AUTOGENERATE_ALWAYS|AbstractProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS|AbstractProxyFactory::AUTOGENERATE_EVAL|AbstractProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS_OR_CHANGED
23+
* @psalm-type AutogenerateMode = ProxyFactory::AUTOGENERATE_NEVER|ProxyFactory::AUTOGENERATE_ALWAYS|ProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS|ProxyFactory::AUTOGENERATE_EVAL|ProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS_OR_CHANGED
2424
*/
2525
class ProxyFactory extends AbstractProxyFactory
2626
{
@@ -48,10 +48,10 @@ class ProxyFactory extends AbstractProxyFactory
4848
* @param string $proxyDir The directory to use for the proxy classes. It must exist.
4949
* @param string $proxyNs The namespace to use for the proxy classes.
5050
* @param bool|int $autoGenerate The strategy for automatically generating proxy classes. Possible
51-
* values are constants of {@see AbstractProxyFactory}.
51+
* values are constants of {@see ProxyFactory::AUTOGENERATE_*}.
5252
* @psalm-param bool|AutogenerateMode $autoGenerate
5353
*/
54-
public function __construct(EntityManagerInterface $em, $proxyDir, $proxyNs, $autoGenerate = AbstractProxyFactory::AUTOGENERATE_NEVER)
54+
public function __construct(EntityManagerInterface $em, $proxyDir, $proxyNs, $autoGenerate = self::AUTOGENERATE_NEVER)
5555
{
5656
$proxyGenerator = new ProxyGenerator($proxyDir, $proxyNs);
5757

0 commit comments

Comments
 (0)