Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace proxy layer with ProxyManager's layer #6719

Merged
merged 90 commits into from
Sep 24, 2017
Merged
Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
c6bb257
Stubbing out a retry on the s/`Proxy`/`GhostObjectInterface` replacem…
Ocramius Sep 13, 2017
e4e13d8
Ensuring that the `BasicFunctionalTest` relies on the `GhostObjectInt…
Ocramius Sep 21, 2017
3281233
Prevent setting any values in un-initialized proxies
Ocramius Sep 21, 2017
b40bdf4
Proxy identifier must be set when the proxy is instantiated
Ocramius Sep 21, 2017
3aa245d
Correcting `ProxyFactoryTests`, which were opinionated around past pr…
Ocramius Sep 21, 2017
db0e2bd
Fixing faulty test that was expecting a different entity to bbe hydra…
Ocramius Sep 21, 2017
4277911
Correcting reference to non-existing method
Ocramius Sep 21, 2017
77cf91c
ORM proxy names may be looked up in the class metadata factory - the …
Ocramius Sep 21, 2017
8793b2c
Hardening `ProxiesLikeEntitiesTest` by adding some precondition checks
Ocramius Sep 21, 2017
f94e99f
Cascade operations do not apply to non-initialized proxies: no associ…
Ocramius Sep 21, 2017
468f15f
Transient fields should be skipped by proxy initialization semantics
Ocramius Sep 21, 2017
c48888a
Fixed reference to non-existing method
Ocramius Sep 21, 2017
7301d1e
Cleaning up `ReferenceProxyTest`, which no longer reflects current in…
Ocramius Sep 21, 2017
eaa4198
Correcting `DDC1193Test`, which was using the old `Proxy` API
Ocramius Sep 21, 2017
3332dc8
Corrected `DDC1228Test`, which was quite broken and relying on the ol…
Ocramius Sep 21, 2017
f976992
Correcting `DDC1690Test`: even if a proxy is not yet loaded, it must …
Ocramius Sep 21, 2017
a47d264
The `DefaultQueryCache` still contained `instanceof Proxy` checks - r…
Ocramius Sep 21, 2017
f59919c
Correcting `DDC2231Test`, since proxies no longer initialize if no st…
Ocramius Sep 21, 2017
11c1650
Hardening DDC3223Test with additional pre- and post-conditions
Ocramius Sep 21, 2017
c86ebc6
Removing DDC-1238 related code. Issue seems to be invalid, as cloning…
Ocramius Sep 21, 2017
d433c61
Documenting DDC-1022 tests to be removed, as proxy behavior changed a…
Ocramius Sep 21, 2017
0cf8167
Correcting DDC-1238 to remove non-sensical semantics that cleared pro…
Ocramius Sep 21, 2017
945a217
Correcting metadata factory tests - fetching a class by name does ind…
Ocramius Sep 21, 2017
f269edc
Adding `ocramius/proxy-manager` dependency
Ocramius Sep 21, 2017
14fae86
`SecondLevelCacheManyToOneTest` should not cause more queries for fet…
Ocramius Sep 22, 2017
b54e846
Adding stub implementation of logic that converts a flat identifier i…
Ocramius Sep 22, 2017
d88c0d9
Explicit BC break: we no longer call `__wakeup` on proxies
Ocramius Sep 22, 2017
d35320d
Correcting `ReferenceProxyTest`: proxy identifiers are no longer unse…
Ocramius Sep 22, 2017
a61b023
Stop registering cloned proxies (real instance being managed) as managed
Ocramius Sep 22, 2017
d05258d
The `NotifyPropertyChanged` API should only be used once we decided t…
Ocramius Sep 22, 2017
619918f
Replace `ClassUtils` with a temporary, local, deprecated shim that kn…
Ocramius Sep 22, 2017
03221e0
Beginning work on the `Configuration` overhaul - we want to manage a …
Ocramius Sep 22, 2017
c17085f
Setting a proxy path should update the `ProxyManager\Configuration` i…
Ocramius Sep 22, 2017
cded4eb
Extracting temporary dir generation to a private method
Ocramius Sep 22, 2017
d07735c
Changing auto-generation flag should also change the `ProxyManager\Co…
Ocramius Sep 22, 2017
2c1e816
Verifying that the `Doctrine\ORM\Configuration` builds separate and i…
Ocramius Sep 22, 2017
a8b0c13
Adding `Doctrine\ORM\Configuration` API as per test specification
Ocramius Sep 22, 2017
3ac9c3b
`setProxyNamespace()` should also update the wrapped `ProxyManager\Co…
Ocramius Sep 22, 2017
760e567
`SetupTest` was using invalid proxy paths
Ocramius Sep 22, 2017
58aa0ec
Rewriting `StaticProxyFactory` so its constructor just receives a `Gh…
Ocramius Sep 22, 2017
1baa3b4
Using the `LazyLoadingGhostFactory` to trigger proxy generation
Ocramius Sep 22, 2017
6a9f0a3
Improving performance of the `StaticProxyFactory` by caching all inte…
Ocramius Sep 22, 2017
1cfff1f
Removing all unused proxy-related components
Ocramius Sep 22, 2017
e4081a4
Replacing `ClassUtils` shim usage with a new `StaticClassNameConverte…
Ocramius Sep 22, 2017
44db8ae
Basic tests for the `StaticClassNameConverterTest`
Ocramius Sep 22, 2017
af34e34
Verifying all of the `StaticClassNameConverterTest` API
Ocramius Sep 22, 2017
97ff172
Removed `ClassUtils` shim: class has been internalized
Ocramius Sep 22, 2017
66617f3
Dead code removal
Ocramius Sep 22, 2017
f8c5521
Removing unused import
Ocramius Sep 22, 2017
5461ad8
Removing solved `TODO` in the `Parser` changes
Ocramius Sep 22, 2017
07a4795
Removing solved TODOs and improved documentation around why we work w…
Ocramius Sep 22, 2017
9b7fb24
Removing duplicate `TODO` that was moved to a private method document…
Ocramius Sep 22, 2017
d481795
Simplifying `generateProxyClasses` code
Ocramius Sep 22, 2017
aaf9ba1
Simplified spec for an identifier normalizer
Ocramius Sep 22, 2017
22cdd1f
Completing specification for nested reference identifier normalization
Ocramius Sep 22, 2017
2428c3e
Implemented `NormalizeIdentifier` as per specification
Ocramius Sep 22, 2017
3ebb2e8
Using `NormalizeIdentifier` inside the `UnitOfWork` instead of relyin…
Ocramius Sep 22, 2017
ba76179
Minimal `NormalizeIdentifier` documentation
Ocramius Sep 22, 2017
d1d3e68
Inlining variables that are only used once
Ocramius Sep 22, 2017
8a9d733
Marking utility classes as internal
Ocramius Sep 23, 2017
048f2b6
Extracting `NormalizeIdentifierTest` assets to a `Model` namespace
Ocramius Sep 23, 2017
5f48b38
Verifying that identifiers are preserved when using `EntityManager#ge…
Ocramius Sep 23, 2017
185f1a1
Verifying that identifier order being swapped does not cause identifi…
Ocramius Sep 23, 2017
1b63952
Removing fixed TODO about identifier handling
Ocramius Sep 23, 2017
04d8e2b
Verifying that ghost object friend objects are not initialized when n…
Ocramius Sep 23, 2017
f7e18fa
Verifying friend object "Comparable" behavior when using proxies that…
Ocramius Sep 23, 2017
ad9acc8
Using `AUTOGENERATE_EVAL` during test suite runs
Ocramius Sep 23, 2017
4275999
Adapting proxy configuration documentation to the new changes in the …
Ocramius Sep 23, 2017
96f052b
Removing redundant/conflicting proxy documentation, correcting proxy …
Ocramius Sep 23, 2017
0152c56
`func_get_args()` now works within proxies: YAY!
Ocramius Sep 23, 2017
04a00d0
Updating documentation about proxy serialization
Ocramius Sep 23, 2017
e4f18dc
s/lazy-load/lazy-loading
Ocramius Sep 23, 2017
b9c9349
Removing FAQ entry for item that no longer holds true about `public` …
Ocramius Sep 23, 2017
d79c9dd
Removing documented quirks about proxy lazy-loading semantics combine…
Ocramius Sep 23, 2017
f753ab0
Removing reference to previous proxy model
Ocramius Sep 23, 2017
d1b045f
Replacing generated proxy example with a stub resembling current state
Ocramius Sep 23, 2017
be2a5fc
Cleaning documentation around proxy behavior
Ocramius Sep 23, 2017
2bf972e
Removing erroneous documentation about `final` methods, `c__lone` and…
Ocramius Sep 23, 2017
1b4fe3a
Marking the `StaticProxyFactory` as internal, fixing type hint docume…
Ocramius Sep 23, 2017
c709f8d
Documenting introduced BC breaks in the proxy refactoring
Ocramius Sep 23, 2017
6ae76ae
Clarifying that also reflection now triggers lazy-loading
Ocramius Sep 23, 2017
3a37e7a
Cleaning up performance tests before attempting a fix of the `ProxyIn…
Ocramius Sep 23, 2017
82969c5
Ignoring `phpbench.phar` and the associated public key
Ocramius Sep 23, 2017
72316de
Removing `NonLoadingPersister` specifics that are not to be used in b…
Ocramius Sep 23, 2017
52cab69
CMS Users must be deleted between test revolutions
Ocramius Sep 23, 2017
2c7ab17
Adding missing trailing comma as per @jaapio's review
Ocramius Sep 24, 2017
f510308
BC Break: Removing `getProxyDir`, `getProxyNamespace` and `getAutoGen…
Ocramius Sep 24, 2017
afa2b1a
Documented removal of `getProxyDir`, `getProxyNamespace` and `getAuto…
Ocramius Sep 24, 2017
e70167e
Making sure the `ProxyFactory#createProxy()` is always given a `Class…
Ocramius Sep 24, 2017
da7383b
Static analysis fixes as reported by scrutinizer-ci
Ocramius Sep 24, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ lib/Doctrine/DBAL
vendor/
composer.lock
/tests/Doctrine/Performance/history.db
phpbench.phar
phpbench.phar.pubkey
44 changes: 44 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# Upgrade to 3.0

## BC Break: proxies no longer implement `Doctrine\ORM\Proxy\Proxy`

Proxy objects no longer implement `Doctrine\ORM\Proxy\Proxy` nor
`Doctrine\Common\Persistence\Proxy`: instead, they implement
`ProxyManager\Proxy\GhostObjectInterface`.

These related classes have been removed:

* `Doctrine\ORM\Proxy\ProxyFactory` - replaced by `Doctrine\ORM\Proxy\Factory\StaticProxyFacory`
and `Doctrine\ORM\Proxy\Factory\ProxyFactory`
* `Doctrine\ORM\Proxy\Proxy`
* `Doctrine\ORM\Proxy\Autoloader` - we suggest using the composer autoloader instead
* `Doctrine\ORM\Reflection\RuntimePublicReflectionProperty`

Proxy class names change: the generated proxies now follow
the [`ClassNameInflector`](https://github.com/Ocramius/ProxyManager/blob/2.1.1/src/ProxyManager/Inflector/ClassNameInflector.php)
naming.

Proxies are also always generated if not found: fatal errors due to missing
proxy classes should no longer occur with ORM default settings.

In addition to that, following changes affect entity lazy-loading semantics:

* `final` methods are now allowed
* `__clone` is no longer called by the ORM
* `__wakeup` is no longer called by the ORM
* `serialize($proxy)` will lead to full recursive proxy initialization: please mitigate
the recursive initialization by implementing
the [`Serializable`](https://secure.php.net/manual/en/class.serializable.php) interface
* `clone $proxy` will lead to full initialization of the cloned instance, not the
original instance
* lazy-loading a detached proxy no longer causes the proxy identifiers to be reset
to `null`
* identifier properties are always set when the ORM produces a proxy instance
* calling a method on a proxy no longer causes proxy lazy-loading if the method does
not access any un-initialized proxy state
* accessing entity private state, even with reflection, will trigger lazy-loading

The following methods have been deprecated, and should no longer be used:

* `Doctrine\ORM\Configuration#getProxyDir()`
* `Doctrine\ORM\Configuration#getAutoGenerateProxyClasses()`
* `Doctrine\ORM\Configuration#getProxyNamespace()`

## BC Break: Removed `Doctrine\ORM\Version`

The `Doctrine\ORM\Version` class is no longer available: please refrain from checking the ORM version at runtime.
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"doctrine/cache": "~1.6",
"doctrine/annotations": "~1.4",
"ocramius/package-versions": "^1.1.2",
"ocramius/proxy-manager": "^2.1.1",
"symfony/console": "~3.0|~4.0"
},
"require-dev": {
Expand Down
78 changes: 0 additions & 78 deletions docs/en/cookbook/implementing-wakeup-or-clone.rst

This file was deleted.

10 changes: 2 additions & 8 deletions docs/en/cookbook/integrating-with-codeigniter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ Customize it to your needs.
$doctrineClassLoader->register();
$entitiesClassLoader = new ClassLoader('models', rtrim(APPPATH, "/" ));
$entitiesClassLoader->register();
$proxiesClassLoader = new ClassLoader('Proxies', APPPATH.'models/proxies');
$proxiesClassLoader->register();

// Set up caches
$config = new Configuration;
Expand All @@ -80,17 +78,13 @@ Customize it to your needs.
$config->setQueryCacheImpl($cache);

$config->setQueryCacheImpl($cache);

// Proxy configuration

$config->setProxyDir(APPPATH.'/models/proxies');
$config->setProxyNamespace('Proxies');

// Set up logger
$logger = new EchoSQLLogger;
$config->setSQLLogger($logger);

$config->setAutoGenerateProxyClasses( TRUE );

// Database connection information
$connectionOptions = array(
'driver' => 'pdo_mysql',
Expand All @@ -108,7 +102,7 @@ Customize it to your needs.
Please note that this is a development configuration; for a
production system you'll want to use a real caching system like
APC, get rid of EchoSqlLogger, and turn off
autoGenerateProxyClasses.
proxy auto-generation.

For more details, consult the
`Doctrine 2 Configuration documentation <http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/configuration.html>`_.
Expand Down
1 change: 0 additions & 1 deletion docs/en/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ Cookbook
* **Implementation**:
:doc:`Array Access <cookbook/implementing-arrayaccess-for-domain-objects>` |
:doc:`Notify ChangeTracking Example <cookbook/implementing-the-notify-changetracking-policy>` |
:doc:`Using Wakeup Or Clone <cookbook/implementing-wakeup-or-clone>` |
:doc:`Working with DateTime <cookbook/working-with-datetime>` |
:doc:`Validation <cookbook/validation-of-entities>` |
:doc:`Entities in the Session <cookbook/entities-in-session>` |
Expand Down
Loading