From 570abb5bad0760ba254965f5799b9ff26fb085e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Fri, 15 Nov 2019 14:37:27 +0100 Subject: [PATCH 1/4] Fix PHP warnings in test suite --- tests/Doctrine/Tests/OrmFunctionalTestCase.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Doctrine/Tests/OrmFunctionalTestCase.php b/tests/Doctrine/Tests/OrmFunctionalTestCase.php index d45ebac6387..93b07447c8c 100644 --- a/tests/Doctrine/Tests/OrmFunctionalTestCase.php +++ b/tests/Doctrine/Tests/OrmFunctionalTestCase.php @@ -341,7 +341,9 @@ protected function tearDown() $platform = $conn->getDatabasePlatform(); - $this->_sqlLoggerStack->enabled = false; + if ($this->_sqlLoggerStack instanceof DebugStack) { + $this->_sqlLoggerStack->enabled = false; + } if (isset($this->_usedModelSets['cms'])) { $conn->executeUpdate('DELETE FROM cms_users_groups'); From 2b8cb9de798a2b939d751d288e4335a3f422ff8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Fri, 15 Nov 2019 14:37:40 +0100 Subject: [PATCH 2/4] Add basic tool to verify deprecation messages --- tests/Doctrine/Tests/VerifyDeprecations.php | 69 +++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tests/Doctrine/Tests/VerifyDeprecations.php diff --git a/tests/Doctrine/Tests/VerifyDeprecations.php b/tests/Doctrine/Tests/VerifyDeprecations.php new file mode 100644 index 00000000000..8ccd9472e64 --- /dev/null +++ b/tests/Doctrine/Tests/VerifyDeprecations.php @@ -0,0 +1,69 @@ +actualDeprecations = []; + $this->expectedDeprecations = []; + + $this->originalHandler = set_error_handler( + function (int $errorNumber, string $errorMessage) : void { + $this->actualDeprecations[] = $errorMessage; + }, + E_USER_DEPRECATED + ); + } + + /** @after */ + public function resetErrorHandler() : void + { + set_error_handler($this->originalHandler, E_USER_DEPRECATED); + $this->originalHandler = null; + } + + /** @after */ + public function validateDeprecationExpectations() : void + { + if ($this->expectedDeprecations === []) { + return; + } + + self::assertSame( + $this->expectedDeprecations, + $this->actualDeprecations, + 'Triggered deprecation messages do not match with expected ones.' + ); + } + + protected function expectDeprecationMessage(string $message) : void + { + $this->expectedDeprecations[] = $message; + } + + protected function assertHasDeprecationMessages() : void + { + self::assertNotSame([], $this->actualDeprecations, 'Failed asserting that test has triggered deprecation messages.'); + } + + protected function assertNotHasDeprecationMessages() : void + { + self::assertSame([], $this->actualDeprecations, 'Failed asserting that test has not triggered deprecation messages.'); + } +} From eb9f11bf968834cd2fd5875daf34cddbf6a62e11 Mon Sep 17 00:00:00 2001 From: Michael Moravec Date: Fri, 8 Dec 2017 21:13:42 +0100 Subject: [PATCH 3/4] Added deprecation warnings for 2.x --- composer.lock | 383 ++++++++---------- lib/Doctrine/ORM/Configuration.php | 9 + lib/Doctrine/ORM/EntityManager.php | 18 + lib/Doctrine/ORM/EntityManagerInterface.php | 2 +- .../ORM/Mapping/Driver/YamlDriver.php | 8 + lib/Doctrine/ORM/Proxy/Proxy.php | 2 + lib/Doctrine/ORM/Proxy/ProxyFactory.php | 2 + .../Command/ConvertDoctrine1SchemaCommand.php | 6 + .../Command/GenerateEntitiesCommand.php | 3 + .../Command/GenerateRepositoriesCommand.php | 3 + lib/Doctrine/ORM/Tools/EntityGenerator.php | 5 + .../ORM/Tools/EntityRepositoryGenerator.php | 8 + .../Tools/Export/ClassMetadataExporter.php | 9 + .../Tools/Export/Driver/AbstractExporter.php | 5 + .../Export/Driver/AnnotationExporter.php | 2 + .../ORM/Tools/Export/Driver/PhpExporter.php | 2 + .../ORM/Tools/Export/Driver/XmlExporter.php | 2 + .../ORM/Tools/Export/Driver/YamlExporter.php | 2 + .../ORM/Tools/Export/ExportException.php | 3 + lib/Doctrine/ORM/UnitOfWork.php | 4 +- lib/Doctrine/ORM/Version.php | 2 + .../Decorator/EntityManagerDecoratorTest.php | 11 + .../Doctrine/Tests/ORM/EntityManagerTest.php | 43 ++ .../ORM/Functional/BasicFunctionalTest.php | 16 +- .../ORM/Functional/DetachedEntityTest.php | 9 + .../ORM/Functional/EntityRepositoryTest.php | 4 + .../Functional/MergeCompositeToOneKeyTest.php | 4 + .../Tests/ORM/Functional/MergeProxiesTest.php | 9 + .../Functional/MergeSharedEntitiesTest.php | 9 + .../MergeVersionedManyToOneTest.php | 4 + .../Functional/ProxiesLikeEntitiesTest.php | 2 +- .../ORM/Functional/Ticket/DDC117Test.php | 6 +- .../ORM/Functional/Ticket/DDC1276Test.php | 4 + .../ORM/Functional/Ticket/DDC1383Test.php | 5 + .../ORM/Functional/Ticket/DDC1392Test.php | 4 + .../ORM/Functional/Ticket/DDC1509Test.php | 4 + .../ORM/Functional/Ticket/DDC1594Test.php | 4 + .../ORM/Functional/Ticket/DDC1734Test.php | 9 + .../ORM/Functional/Ticket/DDC2106Test.php | 2 +- .../ORM/Functional/Ticket/DDC2230Test.php | 5 + .../ORM/Functional/Ticket/DDC2409Test.php | 8 +- .../ORM/Functional/Ticket/DDC2645Test.php | 5 + .../ORM/Functional/Ticket/DDC2790Test.php | 2 +- .../ORM/Functional/Ticket/DDC2984Test.php | 2 +- .../ORM/Functional/Ticket/DDC3699Test.php | 9 + .../ORM/Functional/Ticket/DDC3711Test.php | 4 + .../ORM/Functional/Ticket/DDC501Test.php | 4 + .../ORM/Functional/Ticket/DDC518Test.php | 5 + .../ORM/Functional/Ticket/DDC729Test.php | 9 + .../ORM/Functional/Ticket/DDC758Test.php | 8 + .../Tests/ORM/Functional/ValueObjectsTest.php | 6 +- .../ORM/Mapping/Symfony/YamlDriverTest.php | 4 + .../ORM/Mapping/YamlMappingDriverTest.php | 11 + .../ConvertDoctrine1SchemaCommandTest.php | 9 + .../GenerateRepositoriesCommandTest.php | 5 + .../ORM/Tools/ConvertDoctrine1SchemaTest.php | 4 + .../Tests/ORM/Tools/EntityGeneratorTest.php | 8 + .../Tools/EntityRepositoryGeneratorTest.php | 9 + .../AbstractClassMetadataExporterTest.php | 5 + tests/Doctrine/Tests/ORM/Tools/SetupTest.php | 4 + 60 files changed, 523 insertions(+), 232 deletions(-) diff --git a/composer.lock b/composer.lock index be48f0e64a7..1641a17b142 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c3d70a08d75cd3995dd4c72864f3c880", + "content-hash": "084cd36de51fd4aa52c912b3e9c7c799", "packages": [ { "name": "doctrine/annotations", @@ -76,16 +76,16 @@ }, { "name": "doctrine/cache", - "version": "v1.8.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "d768d58baee9a4862ca783840eca1b9add7a7f57" + "reference": "c15dcd24b756f9e52ea7c3ae8227354f3628f11a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/d768d58baee9a4862ca783840eca1b9add7a7f57", - "reference": "d768d58baee9a4862ca783840eca1b9add7a7f57", + "url": "https://api.github.com/repos/doctrine/cache/zipball/c15dcd24b756f9e52ea7c3ae8227354f3628f11a", + "reference": "c15dcd24b756f9e52ea7c3ae8227354f3628f11a", "shasum": "" }, "require": { @@ -96,7 +96,7 @@ }, "require-dev": { "alcaeus/mongo-php-adapter": "^1.1", - "doctrine/coding-standard": "^4.0", + "doctrine/coding-standard": "^6.0", "mongodb/mongodb": "^1.1", "phpunit/phpunit": "^7.0", "predis/predis": "~1.0" @@ -107,7 +107,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.9.x-dev" } }, "autoload": { @@ -120,6 +120,10 @@ "MIT" ], "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -128,10 +132,6 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, { "name": "Jonathan Wage", "email": "jonwage@gmail.com" @@ -141,46 +141,52 @@ "email": "schmittjoh@gmail.com" } ], - "description": "Caching library offering an object-oriented API for many cache backends", - "homepage": "https://www.doctrine-project.org", + "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", + "homepage": "https://www.doctrine-project.org/projects/cache.html", "keywords": [ + "abstraction", + "apcu", "cache", - "caching" + "caching", + "couchdb", + "memcached", + "php", + "redis", + "riak", + "xcache" ], - "time": "2018-08-21T18:01:43+00:00" + "time": "2019-11-11T10:31:52+00:00" }, { "name": "doctrine/collections", - "version": "v1.6.2", + "version": "v1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "c5e0bc17b1620e97c968ac409acbff28b8b850be" + "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/c5e0bc17b1620e97c968ac409acbff28b8b850be", - "reference": "c5e0bc17b1620e97c968ac409acbff28b8b850be", + "url": "https://api.github.com/repos/doctrine/collections/zipball/a01ee38fcd999f34d9bfbcee59dbda5105449cbf", + "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^7.1" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan-shim": "^0.9.2", - "phpunit/phpunit": "^7.0", - "vimeo/psalm": "^3.2.2" + "doctrine/coding-standard": "~0.1@dev", + "phpunit/phpunit": "^5.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { - "psr-4": { - "Doctrine\\Common\\Collections\\": "lib/Doctrine/Common/Collections" + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" } }, "notification-url": "https://packagist.org/downloads/", @@ -209,15 +215,14 @@ "email": "schmittjoh@gmail.com" } ], - "description": "PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.", - "homepage": "https://www.doctrine-project.org/projects/collections.html", + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", "keywords": [ "array", "collections", - "iterators", - "php" + "iterator" ], - "time": "2019-06-09T13:48:14+00:00" + "time": "2017-07-22T10:37:32+00:00" }, { "name": "doctrine/common", @@ -304,16 +309,16 @@ }, { "name": "doctrine/dbal", - "version": "v2.9.2", + "version": "v2.9.3", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "22800bd651c1d8d2a9719e2a3dc46d5108ebfcc9" + "reference": "7345cd59edfa2036eb0fa4264b77ae2576842035" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/22800bd651c1d8d2a9719e2a3dc46d5108ebfcc9", - "reference": "22800bd651c1d8d2a9719e2a3dc46d5108ebfcc9", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/7345cd59edfa2036eb0fa4264b77ae2576842035", + "reference": "7345cd59edfa2036eb0fa4264b77ae2576842035", "shasum": "" }, "require": { @@ -353,6 +358,10 @@ "MIT" ], "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -361,10 +370,6 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, { "name": "Jonathan Wage", "email": "jonwage@gmail.com" @@ -382,20 +387,20 @@ "php", "queryobject" ], - "time": "2018-12-31T03:27:51+00:00" + "time": "2019-11-02T22:19:34+00:00" }, { "name": "doctrine/event-manager", - "version": "v1.0.0", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3" + "reference": "629572819973f13486371cb611386eb17851e85c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/a520bc093a0170feeb6b14e9d83f3a14452e64b3", - "reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/629572819973f13486371cb611386eb17851e85c", + "reference": "629572819973f13486371cb611386eb17851e85c", "shasum": "" }, "require": { @@ -405,7 +410,7 @@ "doctrine/common": "<2.9@dev" }, "require-dev": { - "doctrine/coding-standard": "^4.0", + "doctrine/coding-standard": "^6.0", "phpunit/phpunit": "^7.0" }, "type": "library", @@ -424,6 +429,10 @@ "MIT" ], "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -432,10 +441,6 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, { "name": "Jonathan Wage", "email": "jonwage@gmail.com" @@ -449,27 +454,29 @@ "email": "ocramius@gmail.com" } ], - "description": "Doctrine Event Manager component", + "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", "homepage": "https://www.doctrine-project.org/projects/event-manager.html", "keywords": [ "event", - "eventdispatcher", - "eventmanager" + "event dispatcher", + "event manager", + "event system", + "events" ], - "time": "2018-06-11T11:59:03+00:00" + "time": "2019-11-10T09:48:07+00:00" }, { "name": "doctrine/inflector", - "version": "v1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "5527a48b7313d15261292c149e55e26eae771b0a" + "reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a", - "reference": "5527a48b7313d15261292c149e55e26eae771b0a", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/ec3a55242203ffa6a4b27c58176da97ff0a7aec1", + "reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1", "shasum": "" }, "require": { @@ -494,6 +501,10 @@ "MIT" ], "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -502,10 +513,6 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, { "name": "Jonathan Wage", "email": "jonwage@gmail.com" @@ -523,20 +530,20 @@ "singularize", "string" ], - "time": "2018-01-09T20:05:19+00:00" + "time": "2019-10-30T19:59:35+00:00" }, { "name": "doctrine/instantiator", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "a2c590166b2133a4633738648b6b064edae0814a" + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", - "reference": "a2c590166b2133a4633738648b6b064edae0814a", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", "shasum": "" }, "require": { @@ -579,7 +586,7 @@ "constructor", "instantiate" ], - "time": "2019-03-17T17:37:11+00:00" + "time": "2019-10-21T16:45:58+00:00" }, { "name": "doctrine/lexer", @@ -643,16 +650,16 @@ }, { "name": "doctrine/persistence", - "version": "1.1.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/persistence.git", - "reference": "3da7c9d125591ca83944f477e65ed3d7b4617c48" + "reference": "43526ae63312942e5316100bb3ed589ba1aba491" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/persistence/zipball/3da7c9d125591ca83944f477e65ed3d7b4617c48", - "reference": "3da7c9d125591ca83944f477e65ed3d7b4617c48", + "url": "https://api.github.com/repos/doctrine/persistence/zipball/43526ae63312942e5316100bb3ed589ba1aba491", + "reference": "43526ae63312942e5316100bb3ed589ba1aba491", "shasum": "" }, "require": { @@ -674,7 +681,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -687,6 +694,10 @@ "MIT" ], "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -695,10 +706,6 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, { "name": "Jonathan Wage", "email": "jonwage@gmail.com" @@ -721,7 +728,7 @@ "orm", "persistence" ], - "time": "2019-04-23T08:28:24+00:00" + "time": "2019-04-23T12:39:21+00:00" }, { "name": "doctrine/reflection", @@ -799,17 +806,17 @@ "time": "2018-06-14T14:45:07+00:00" }, { - "name": "psr/container", - "version": "1.0.0", + "name": "psr/log", + "version": "1.1.2", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "url": "https://github.com/php-fig/log.git", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", "shasum": "" }, "require": { @@ -818,12 +825,12 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Container\\": "src/" + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -836,40 +843,36 @@ "homepage": "http://www.php-fig.org/" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "log", + "psr", + "psr-3" ], - "time": "2017-02-14T16:28:37+00:00" + "time": "2019-11-01T11:05:21+00:00" }, { "name": "symfony/console", - "version": "v4.3.5", + "version": "v3.4.35", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "929ddf360d401b958f611d44e726094ab46a7369" + "reference": "17b154f932c5874cdbda6d05796b6490eec9f9f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/929ddf360d401b958f611d44e726094ab46a7369", - "reference": "929ddf360d401b958f611d44e726094ab46a7369", + "url": "https://api.github.com/repos/symfony/console/zipball/17b154f932c5874cdbda6d05796b6490eec9f9f7", + "reference": "17b154f932c5874cdbda6d05796b6490eec9f9f7", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/service-contracts": "^1.1" + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3", "symfony/process": "<3.3" }, "provide": { @@ -877,12 +880,11 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", + "symfony/config": "~3.3|~4.0", "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "^4.3", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0", - "symfony/var-dumper": "^4.3" + "symfony/process": "~3.3|~4.0" }, "suggest": { "psr/log": "For using the console logger", @@ -893,7 +895,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -920,40 +922,44 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-10-07T12:36:49+00:00" + "time": "2019-11-13T07:12:39+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.12.0", + "name": "symfony/debug", + "version": "v3.4.35", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" + "url": "https://github.com/symfony/debug.git", + "reference": "f72e33fdb1170b326e72c3157f0cd456351dd086" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", - "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "url": "https://api.github.com/repos/symfony/debug/zipball/f72e33fdb1170b326e72c3157f0cd456351dd086", + "reference": "f72e33fdb1170b326e72c3157f0cd456351dd086", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0" }, - "suggest": { - "ext-mbstring": "For best performance" + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "3.4-dev" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Symfony\\Component\\Debug\\": "" }, - "files": [ - "bootstrap.php" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -962,42 +968,38 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-10-24T15:33:53+00:00" }, { - "name": "symfony/polyfill-php73", + "name": "symfony/polyfill-mbstring", "version": "v1.12.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "2ceb49eaccb9352bff54d22570276bb75ba4a188" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/2ceb49eaccb9352bff54d22570276bb75ba4a188", - "reference": "2ceb49eaccb9352bff54d22570276bb75ba4a188", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "suggest": { + "ext-mbstring": "For best performance" + }, "type": "library", "extra": { "branch-alias": { @@ -1006,13 +1008,10 @@ }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" + "Symfony\\Polyfill\\Mbstring\\": "" }, "files": [ "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1029,73 +1028,16 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "description": "Symfony polyfill for the Mbstring extension", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "mbstring", "polyfill", "portable", "shim" ], "time": "2019-08-06T08:03:45+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v1.1.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "ffcde9615dc5bb4825b9f6aed07716f1f57faae0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffcde9615dc5bb4825b9f6aed07716f1f57faae0", - "reference": "ffcde9615dc5bb4825b9f6aed07716f1f57faae0", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "psr/container": "^1.0" - }, - "suggest": { - "symfony/service-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "time": "2019-09-17T11:12:18+00:00" } ], "packages-dev": [ @@ -1843,16 +1785,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.5.16", + "version": "7.5.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "316afa6888d2562e04aeb67ea7f2017a0eb41661" + "reference": "4c92a15296e58191a4cd74cff3b34fc8e374174a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/316afa6888d2562e04aeb67ea7f2017a0eb41661", - "reference": "316afa6888d2562e04aeb67ea7f2017a0eb41661", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4c92a15296e58191a4cd74cff3b34fc8e374174a", + "reference": "4c92a15296e58191a4cd74cff3b34fc8e374174a", "shasum": "" }, "require": { @@ -1923,7 +1865,7 @@ "testing", "xunit" ], - "time": "2019-09-14T09:08:39+00:00" + "time": "2019-10-28T10:37:36+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -2532,16 +2474,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.1", + "version": "3.5.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "82cd0f854ceca17731d6d019c7098e3755c45060" + "reference": "65b12cdeaaa6cd276d4c3033a95b9b88b12701e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/82cd0f854ceca17731d6d019c7098e3755c45060", - "reference": "82cd0f854ceca17731d6d019c7098e3755c45060", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/65b12cdeaaa6cd276d4c3033a95b9b88b12701e7", + "reference": "65b12cdeaaa6cd276d4c3033a95b9b88b12701e7", "shasum": "" }, "require": { @@ -2579,7 +2521,7 @@ "phpcs", "standards" ], - "time": "2019-10-16T21:14:26+00:00" + "time": "2019-10-28T04:36:32+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2641,20 +2583,20 @@ }, { "name": "symfony/yaml", - "version": "v4.3.5", + "version": "v3.4.35", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "41e16350a2a1c7383c4735aa2f9fce74cf3d1178" + "reference": "dab657db15207879217fc81df4f875947bf68804" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/41e16350a2a1c7383c4735aa2f9fce74cf3d1178", - "reference": "41e16350a2a1c7383c4735aa2f9fce74cf3d1178", + "url": "https://api.github.com/repos/symfony/yaml/zipball/dab657db15207879217fc81df4f875947bf68804", + "reference": "dab657db15207879217fc81df4f875947bf68804", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-ctype": "~1.8" }, "conflict": { @@ -2669,7 +2611,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2696,7 +2638,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-09-11T15:41:19+00:00" + "time": "2019-10-24T15:33:53+00:00" }, { "name": "theseer/tokenizer", @@ -2798,5 +2740,8 @@ "php": "^7.1", "ext-pdo": "*" }, - "platform-dev": [] + "platform-dev": [], + "platform-overrides": { + "php": "7.1" + } } diff --git a/lib/Doctrine/ORM/Configuration.php b/lib/Doctrine/ORM/Configuration.php index 6073fbe008c..f4ba5df066b 100644 --- a/lib/Doctrine/ORM/Configuration.php +++ b/lib/Doctrine/ORM/Configuration.php @@ -70,6 +70,9 @@ public function setProxyDir($dir) * Gets the directory where Doctrine generates any necessary proxy class files. * * @return string|null + * + * @deprecated 3.0 We're switch to `ocramius/proxy-manager` and this method isn't applicable any longer + * @see https://github.com/Ocramius/ProxyManager */ public function getProxyDir() { @@ -82,6 +85,9 @@ public function getProxyDir() * Gets the strategy for automatically generating proxy classes. * * @return int Possible values are constants of Doctrine\Common\Proxy\AbstractProxyFactory. + * + * @deprecated 3.0 We're switch to `ocramius/proxy-manager` and this method isn't applicable any longer + * @see https://github.com/Ocramius/ProxyManager */ public function getAutoGenerateProxyClasses() { @@ -107,6 +113,9 @@ public function setAutoGenerateProxyClasses($autoGenerate) * Gets the namespace where proxy classes reside. * * @return string|null + * + * @deprecated 3.0 We're switch to `ocramius/proxy-manager` and this method isn't applicable any longer + * @see https://github.com/Ocramius/ProxyManager */ public function getProxyNamespace() { diff --git a/lib/Doctrine/ORM/EntityManager.php b/lib/Doctrine/ORM/EntityManager.php index c5204f3fb55..f003c089811 100644 --- a/lib/Doctrine/ORM/EntityManager.php +++ b/lib/Doctrine/ORM/EntityManager.php @@ -29,6 +29,7 @@ use Doctrine\ORM\Query\FilterCollection; use Doctrine\Common\Util\ClassUtils; use Throwable; +use function trigger_error; /** * The EntityManager is the central access point to ORM functionality. @@ -354,6 +355,13 @@ public function createQueryBuilder() */ public function flush($entity = null) { + if ($entity !== null) { + @trigger_error( + 'Calling ' . __METHOD__ . '() with any arguments to flush specific entities is deprecated and will not be supported in Doctrine 3.0.', + E_USER_DEPRECATED + ); + } + $this->errorIfClosed(); $this->unitOfWork->commit($entity); @@ -649,9 +657,13 @@ public function refresh($entity) * @return void * * @throws ORMInvalidArgumentException + * + * @deprecated 3.0 This method is being removed from the ORM and won't have any replacement */ public function detach($entity) { + @trigger_error('Method ' . __METHOD__ . '() is deprecated and will be removed in Doctrine 3.0.', E_USER_DEPRECATED); + if ( ! is_object($entity)) { throw ORMInvalidArgumentException::invalidObject('EntityManager#detach()', $entity); } @@ -670,9 +682,13 @@ public function detach($entity) * * @throws ORMInvalidArgumentException * @throws ORMException + * + * @deprecated 3.0 This method is being removed from the ORM and won't have any replacement */ public function merge($entity) { + @trigger_error('Method ' . __METHOD__ . '() is deprecated and will be removed in Doctrine 3.0.', E_USER_DEPRECATED); + if ( ! is_object($entity)) { throw ORMInvalidArgumentException::invalidObject('EntityManager#merge()', $entity); } @@ -687,6 +703,8 @@ public function merge($entity) */ public function copy($entity, $deep = false) { + @trigger_error('Method ' . __METHOD__ . '() is deprecated and will be removed in Doctrine 3.0.', E_USER_DEPRECATED); + throw new \BadMethodCallException("Not implemented."); } diff --git a/lib/Doctrine/ORM/EntityManagerInterface.php b/lib/Doctrine/ORM/EntityManagerInterface.php index 8bbc56798b2..16b7068b93d 100644 --- a/lib/Doctrine/ORM/EntityManagerInterface.php +++ b/lib/Doctrine/ORM/EntityManagerInterface.php @@ -190,7 +190,7 @@ public function close(); /** * Creates a copy of the given entity. Can create a shallow or a deep copy. * - * @deprecated method will be removed in 3.0 + * @deprecated 3.0 This method is being removed from the ORM and won't have any replacement * * @param object $entity The entity to copy. * @param boolean $deep FALSE for a shallow copy, TRUE for a deep copy. diff --git a/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php index efd5accbc7f..aa99f4bfeec 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php @@ -25,6 +25,7 @@ use Doctrine\ORM\Mapping\ClassMetadata as Metadata; use Doctrine\ORM\Mapping\MappingException; use Symfony\Component\Yaml\Yaml; +use function trigger_error; /** * The YamlDriver reads the mapping metadata from yaml schema files. @@ -34,6 +35,8 @@ * @author Guilherme Blanco * @author Jonathan H. Wage * @author Roman Borschel + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ class YamlDriver extends FileDriver { @@ -44,6 +47,11 @@ class YamlDriver extends FileDriver */ public function __construct($locator, $fileExtension = self::DEFAULT_FILE_EXTENSION) { + @trigger_error( + 'YAML mapping driver is deprecated and will be removed in Doctrine 3.0, please migrate to annotation or XML driver.', + E_USER_DEPRECATED + ); + parent::__construct($locator, $fileExtension); } diff --git a/lib/Doctrine/ORM/Proxy/Proxy.php b/lib/Doctrine/ORM/Proxy/Proxy.php index f478d4905c0..72463d121e3 100644 --- a/lib/Doctrine/ORM/Proxy/Proxy.php +++ b/lib/Doctrine/ORM/Proxy/Proxy.php @@ -26,6 +26,8 @@ * * @author Roman Borschel * @since 2.0 + * + * @deprecated 3.0 This interface is being removed from the ORM and won't have any replacement, proxies will no longer implement it. */ interface Proxy extends BaseProxy { diff --git a/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/lib/Doctrine/ORM/Proxy/ProxyFactory.php index 16cfde9317a..7648a14a5f8 100644 --- a/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -37,6 +37,8 @@ * @author Giorgio Sironi * @author Marco Pivetta * @since 2.0 + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ class ProxyFactory extends AbstractProxyFactory { diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php index 112efb96427..1fac2497be9 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php @@ -27,6 +27,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; /** * Command to convert a Doctrine 1 schema to a Doctrine 2 mapping file. @@ -37,6 +38,8 @@ * @author Guilherme Blanco * @author Jonathan Wage * @author Roman Borschel + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ class ConvertDoctrine1SchemaCommand extends Command { @@ -116,6 +119,9 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { + $ui = new SymfonyStyle($input, $output); + $ui->warning('Command ' . $this->getName() . ' is deprecated and will be removed in Doctrine 3.0.'); + // Process source directories $fromPaths = array_merge([$input->getArgument('from-path')], $input->getOption('from')); diff --git a/lib/Doctrine/ORM/Tools/Console/Command/GenerateEntitiesCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/GenerateEntitiesCommand.php index 828c1432db5..3aff45b7c73 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/GenerateEntitiesCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/GenerateEntitiesCommand.php @@ -38,6 +38,8 @@ * @author Guilherme Blanco * @author Jonathan Wage * @author Roman Borschel + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ class GenerateEntitiesCommand extends Command { @@ -87,6 +89,7 @@ class is supposed to extend which. You have to adjust the entity protected function execute(InputInterface $input, OutputInterface $output) { $ui = new SymfonyStyle($input, $output); + $ui->warning('Command ' . $this->getName() . ' is deprecated and will be removed in Doctrine 3.0.'); $em = $this->getHelper('em')->getEntityManager(); diff --git a/lib/Doctrine/ORM/Tools/Console/Command/GenerateRepositoriesCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/GenerateRepositoriesCommand.php index 666ae7867bd..c09f10fdf25 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/GenerateRepositoriesCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/GenerateRepositoriesCommand.php @@ -37,6 +37,8 @@ * @author Guilherme Blanco * @author Jonathan Wage * @author Roman Borschel + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ class GenerateRepositoriesCommand extends Command { @@ -59,6 +61,7 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $ui = new SymfonyStyle($input, $output); + $ui->warning('Command ' . $this->getName() . ' is deprecated and will be removed in Doctrine 3.0.'); $em = $this->getHelper('em')->getEntityManager(); diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index 89761838c83..5143f637a87 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -24,6 +24,7 @@ use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Mapping\ClassMetadataInfo; use function str_replace; +use function trigger_error; /** * Generic class used to generate PHP5 entity classes from ClassMetadataInfo instances. @@ -45,6 +46,8 @@ * @author Guilherme Blanco * @author Jonathan Wage * @author Roman Borschel + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ class EntityGenerator { @@ -335,6 +338,8 @@ public function __construct() */ public function __construct() { + @trigger_error(self::class . ' is deprecated and will be removed in Doctrine 3.0', E_USER_DEPRECATED); + if (version_compare(\Doctrine\Common\Version::VERSION, '2.2.0-DEV', '>=')) { $this->annotationsPrefix = 'ORM\\'; } diff --git a/lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php b/lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php index dbfcbc6d49f..7dffe97eaa5 100644 --- a/lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php @@ -20,6 +20,7 @@ namespace Doctrine\ORM\Tools; use Doctrine\ORM\EntityRepository; +use function trigger_error; /** * Class to generate entity repository classes @@ -31,6 +32,8 @@ * @author Guilherme Blanco * @author Jonathan Wage * @author Roman Borschel + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ class EntityRepositoryGenerator { @@ -52,6 +55,11 @@ class extends } '; + public function __construct() + { + @trigger_error(self::class . ' is deprecated and will be removed in Doctrine 3.0', E_USER_DEPRECATED); + } + /** * @param string $fullClassName * diff --git a/lib/Doctrine/ORM/Tools/Export/ClassMetadataExporter.php b/lib/Doctrine/ORM/Tools/Export/ClassMetadataExporter.php index ab44263cdf4..fcb11cc2d9b 100644 --- a/lib/Doctrine/ORM/Tools/Export/ClassMetadataExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/ClassMetadataExporter.php @@ -19,6 +19,8 @@ namespace Doctrine\ORM\Tools\Export; +use function trigger_error; + /** * Class used for converting your mapping information between the * supported formats: yaml, xml, and php/annotation. @@ -26,6 +28,8 @@ * @link www.doctrine-project.org * @since 2.0 * @author Jonathan Wage + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ class ClassMetadataExporter { @@ -40,6 +44,11 @@ class ClassMetadataExporter 'annotation' => Driver\AnnotationExporter::class ]; + public function __construct() + { + @trigger_error(self::class . ' is deprecated and will be removed in Doctrine 3.0', E_USER_DEPRECATED); + } + /** * Registers a new exporter driver class under a specified name. * diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php index 100e16fd00f..96cb88b36cb 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php @@ -21,6 +21,7 @@ use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Tools\Export\ExportException; +use function trigger_error; /** * Abstract base class which is to be used for the Exporter drivers @@ -29,6 +30,8 @@ * @link www.doctrine-project.org * @since 2.0 * @author Jonathan Wage + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ abstract class AbstractExporter { @@ -57,6 +60,8 @@ abstract class AbstractExporter */ public function __construct($dir = null) { + @trigger_error(static::class . ' is deprecated and will be removed in Doctrine 3.0', E_USER_DEPRECATED); + $this->_outputDir = $dir; } diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php index 171ac872849..2e7e4cbfd14 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php @@ -28,6 +28,8 @@ * @link www.doctrine-project.org * @since 2.0 * @author Jonathan Wage + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ class AnnotationExporter extends AbstractExporter { diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php index c918c71dd51..3e92dfe5773 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php @@ -27,6 +27,8 @@ * @link www.doctrine-project.org * @since 2.0 * @author Jonathan Wage + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ class PhpExporter extends AbstractExporter { diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php index 60dabe97336..7ea41f0da49 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php @@ -28,6 +28,8 @@ * @link www.doctrine-project.org * @since 2.0 * @author Jonathan Wage + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ class XmlExporter extends AbstractExporter { diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php index c20c3a4fe6a..7043e0a3716 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php @@ -28,6 +28,8 @@ * @link www.doctrine-project.org * @since 2.0 * @author Jonathan Wage + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ class YamlExporter extends AbstractExporter { diff --git a/lib/Doctrine/ORM/Tools/Export/ExportException.php b/lib/Doctrine/ORM/Tools/Export/ExportException.php index 853159f17de..c9689d0a519 100644 --- a/lib/Doctrine/ORM/Tools/Export/ExportException.php +++ b/lib/Doctrine/ORM/Tools/Export/ExportException.php @@ -21,6 +21,9 @@ use Doctrine\ORM\ORMException; +/** + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement + */ class ExportException extends ORMException { /** diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 82695984b65..98ccd81bdc9 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -1866,7 +1866,7 @@ private function doRemove($entity, array &$visited) * @throws OptimisticLockException If the entity uses optimistic locking through a version * attribute and the version check against the managed copy fails. * - * @todo Require active transaction!? OptimisticLockException may result in undefined state!? + * @deprecated 3.0 This method is being removed from the ORM and won't have any replacement */ public function merge($entity) { @@ -2056,6 +2056,8 @@ private function updateAssociationWithMergedEntity($entity, array $association, * @param object $entity The entity to detach. * * @return void + * + * @deprecated 3.0 This method is being removed from the ORM and won't have any replacement */ public function detach($entity) { diff --git a/lib/Doctrine/ORM/Version.php b/lib/Doctrine/ORM/Version.php index b289a2aa8a5..b0f070a4e24 100644 --- a/lib/Doctrine/ORM/Version.php +++ b/lib/Doctrine/ORM/Version.php @@ -29,6 +29,8 @@ * @author Guilherme Blanco * @author Jonathan Wage * @author Roman Borschel + * + * @deprecated 3.0 This class is being removed from the ORM and won't have any replacement */ class Version { diff --git a/tests/Doctrine/Tests/ORM/Decorator/EntityManagerDecoratorTest.php b/tests/Doctrine/Tests/ORM/Decorator/EntityManagerDecoratorTest.php index b8688d871db..14b06893b8b 100644 --- a/tests/Doctrine/Tests/ORM/Decorator/EntityManagerDecoratorTest.php +++ b/tests/Doctrine/Tests/ORM/Decorator/EntityManagerDecoratorTest.php @@ -5,10 +5,14 @@ use Doctrine\ORM\Decorator\EntityManagerDecorator; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query\ResultSetMapping; +use Doctrine\Tests\VerifyDeprecations; use PHPUnit\Framework\TestCase; +use function in_array; class EntityManagerDecoratorTest extends TestCase { + use VerifyDeprecations; + const VOID_METHODS = [ 'persist', 'remove', @@ -83,5 +87,12 @@ public function testAllMethodCallsAreDelegatedToTheWrappedInstance($method, arra }; $this->assertSame($return, $decorator->$method(...$parameters)); + + if (in_array($method, ['copy', 'merge', 'detach', 'getHydrator'], true)) { + $this->assertHasDeprecationMessages(); + return; + } + + $this->assertNotHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/EntityManagerTest.php b/tests/Doctrine/Tests/ORM/EntityManagerTest.php index a05e8610982..e2774cf2dda 100644 --- a/tests/Doctrine/Tests/ORM/EntityManagerTest.php +++ b/tests/Doctrine/Tests/ORM/EntityManagerTest.php @@ -20,9 +20,12 @@ use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Tests\Models\GeoNames\Country; use Doctrine\Tests\OrmTestCase; +use Doctrine\Tests\VerifyDeprecations; class EntityManagerTest extends OrmTestCase { + use VerifyDeprecations; + /** * @var EntityManager */ @@ -305,4 +308,44 @@ public function testClearManagerWithNullValue() $this->assertFalse($this->_em->contains($entity)); } + + public function testDeprecatedFlushWithArguments() : void + { + $entity = new Country(456, 'United Kingdom'); + $this->_em->persist($entity); + + $this->expectDeprecationMessage('Calling Doctrine\ORM\EntityManager::flush() with any arguments to flush specific entities is deprecated and will not be supported in Doctrine 3.0.'); + $this->_em->flush($entity); + } + + public function testDeprecatedMerge() : void + { + $entity = new Country(456, 'United Kingdom'); + $this->_em->persist($entity); + + $this->expectDeprecationMessage('Method Doctrine\ORM\EntityManager::merge() is deprecated and will be removed in Doctrine 3.0.'); + $this->_em->merge($entity); + } + + public function testDeprecatedDetach() : void + { + $entity = new Country(456, 'United Kingdom'); + $this->_em->persist($entity); + + $this->expectDeprecationMessage('Method Doctrine\ORM\EntityManager::detach() is deprecated and will be removed in Doctrine 3.0.'); + $this->_em->detach($entity); + } + + public function testDeprecatedCopy() : void + { + $entity = new Country(456, 'United Kingdom'); + $this->_em->persist($entity); + + try { + $this->expectDeprecationMessage('Method Doctrine\ORM\EntityManager::copy() is deprecated and will be removed in Doctrine 3.0.'); + $this->_em->copy($entity); + } catch (\BadMethodCallException $e) { + // do nothing + } + } } diff --git a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php index 7bdb846535c..7f19fa83010 100644 --- a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php @@ -16,9 +16,12 @@ use Doctrine\Tests\Models\CMS\CmsPhonenumber; use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Tests\OrmFunctionalTestCase; +use Doctrine\Tests\VerifyDeprecations; class BasicFunctionalTest extends OrmFunctionalTestCase { + use VerifyDeprecations; + protected function setUp() { $this->useModelSet('cms'); @@ -499,7 +502,7 @@ public function testSetSetAssociationWithGetReference() $this->_em->persist($address); $this->_em->flush(); - $this->_em->detach($address); + $this->_em->clear(CmsAddress::class); $this->assertFalse($this->_em->contains($address)); $this->assertTrue($this->_em->contains($user)); @@ -894,6 +897,7 @@ public function testMergePersistsNewEntities() $user2 = $this->_em->find(get_class($managedUser), $userId); $this->assertInstanceOf(CmsUser::class, $user2); + $this->assertHasDeprecationMessages(); } public function testMergeNonPersistedProperties() @@ -921,6 +925,7 @@ public function testMergeNonPersistedProperties() $this->assertNull($user2->nonPersistedProperty); $this->assertNull($user2->nonPersistedPropertyObject); $this->assertEquals('active', $user2->status); + $this->assertHasDeprecationMessages(); } public function testMergeThrowsExceptionIfEntityWithGeneratedIdentifierDoesNotExist() @@ -933,6 +938,7 @@ public function testMergeThrowsExceptionIfEntityWithGeneratedIdentifierDoesNotEx $this->expectException(EntityNotFoundException::class); $this->_em->merge($user); + $this->assertHasDeprecationMessages(); } /** @@ -962,6 +968,7 @@ public function testOneToOneMergeSetNull() $this->_em->clear(); $this->assertNull($this->_em->find(get_class($ph), $ph->phonenumber)->getUser()); + $this->assertHasDeprecationMessages(); } /** @@ -1073,6 +1080,7 @@ public function testFlushManyExplicitEntities() $this->assertTrue($userB->id > 0, 'user b has an id'); $this->assertTrue($userC->id > 0, 'user c has an id'); $this->assertEquals('UserC', $userC->name, 'name has not changed because we did not flush it'); + $this->assertHasDeprecationMessages(); } /** @@ -1094,6 +1102,7 @@ public function testFlushSingleManagedEntity() $user = $this->_em->find(get_class($user), $user->id); $this->assertEquals('administrator', $user->status); + $this->assertHasDeprecationMessages(); } /** @@ -1137,6 +1146,7 @@ public function testFlushSingleAndNewEntity() $this->assertTrue($this->_em->contains($otherUser), "Other user is contained in EntityManager"); $this->assertTrue($otherUser->id > 0, "other user has an id"); + $this->assertHasDeprecationMessages(); } /** @@ -1164,6 +1174,7 @@ public function testFlushAndCascadePersist() $this->assertTrue($this->_em->contains($address), "Other user is contained in EntityManager"); $this->assertTrue($address->id > 0, "other user has an id"); + $this->assertHasDeprecationMessages(); } /** @@ -1213,6 +1224,7 @@ public function testFlushSingleNewEntityThenRemove() $this->_em->clear(); $this->assertNull($this->_em->find(get_class($user), $userId)); + $this->assertHasDeprecationMessages(); } /** @@ -1241,6 +1253,7 @@ public function testProxyIsIgnored() $this->assertTrue($this->_em->contains($otherUser), "Other user is contained in EntityManager"); $this->assertTrue($otherUser->id > 0, "other user has an id"); + $this->assertHasDeprecationMessages(); } /** @@ -1270,6 +1283,7 @@ public function testFlushSingleSaveOnlySingle() $user2 = $this->_em->find(get_class($user2), $user2->id); $this->assertEquals('developer', $user2->status); + $this->assertHasDeprecationMessages(); } /** diff --git a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php index 523c98c0943..b1a98530713 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php @@ -10,6 +10,7 @@ use Doctrine\Tests\Models\CMS\CmsAddress; use Doctrine\Tests\Models\CMS\CmsArticle; use Doctrine\Tests\OrmFunctionalTestCase; +use Doctrine\Tests\VerifyDeprecations; /** * Description of DetachedEntityTest @@ -18,6 +19,8 @@ */ class DetachedEntityTest extends OrmFunctionalTestCase { + use VerifyDeprecations; + protected function setUp() { $this->useModelSet('cms'); @@ -44,6 +47,7 @@ public function testSimpleDetachMerge() $this->assertFalse($user === $user2); $this->assertTrue($this->_em->contains($user2)); $this->assertEquals('Roman B.', $user2->name); + $this->assertHasDeprecationMessages(); } public function testSerializeUnserializeModifyMerge() @@ -105,6 +109,7 @@ public function testSerializeUnserializeModifyMerge() $this->assertInstanceOf(CmsPhonenumber::class, $phonenumbers[0]); $this->assertTrue($this->_em->getUnitOfWork()->isInIdentityMap($phonenumbers[0])); $this->assertTrue($this->_em->contains($phonenumbers[0]), "Failed to assert that first phonenumber in collection is contained inside EntityManager persistence context."); + $this->assertHasDeprecationMessages(); } /** @@ -156,6 +161,7 @@ public function testUninitializedLazyAssociationsAreIgnoredOnMerge() $this->assertInstanceOf(Proxy::class, $managedAddress2->user); $this->assertFalse($managedAddress2->user === $detachedAddress2->user); $this->assertFalse($managedAddress2->user->__isInitialized__); + $this->assertHasDeprecationMessages(); } /** @@ -181,6 +187,7 @@ public function testUseDetachedEntityAsQueryParameter() $this->assertInstanceOf(CmsUser::class, $newUser); $this->assertEquals('gblanco', $newUser->username); + $this->assertHasDeprecationMessages(); } /** @@ -200,6 +207,7 @@ public function testDetachManagedUnpersistedEntity() $this->assertFalse($this->_em->contains($user)); $this->assertFalse($this->_em->getUnitOfWork()->isInIdentityMap($user)); + $this->assertHasDeprecationMessages(); } /** @@ -223,6 +231,7 @@ public function testMergeArticleWrongVersion() $this->expectExceptionMessage('The optimistic lock failed, version 1 was expected, but is actually 2'); $this->_em->merge($article); + $this->assertHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php b/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php index ebc7acee973..b8158c17a01 100644 --- a/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php @@ -20,12 +20,15 @@ use Doctrine\Tests\Models\DDC753\DDC753EntityWithDefaultCustomRepository; use Doctrine\Tests\Models\DDC753\DDC753InvalidRepository; use Doctrine\Tests\OrmFunctionalTestCase; +use Doctrine\Tests\VerifyDeprecations; /** * @author robo */ class EntityRepositoryTest extends OrmFunctionalTestCase { + use VerifyDeprecations; + protected function setUp() { $this->useModelSet('cms'); @@ -969,6 +972,7 @@ public function testMatchingCriteriaNullAssocComparison() $this->assertNull($usersIsNull[0]->getEmail()); $this->assertNull($usersEqNull[0]->getEmail()); + $this->assertHasDeprecationMessages(); } /** diff --git a/tests/Doctrine/Tests/ORM/Functional/MergeCompositeToOneKeyTest.php b/tests/Doctrine/Tests/ORM/Functional/MergeCompositeToOneKeyTest.php index fab94a9066c..54a9bc833da 100644 --- a/tests/Doctrine/Tests/ORM/Functional/MergeCompositeToOneKeyTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/MergeCompositeToOneKeyTest.php @@ -5,9 +5,12 @@ use Doctrine\Tests\Models\MixedToOneIdentity\CompositeToOneKeyState; use Doctrine\Tests\Models\MixedToOneIdentity\Country; use Doctrine\Tests\OrmFunctionalTestCase; +use Doctrine\Tests\VerifyDeprecations; class MergeCompositeToOneKeyTest extends OrmFunctionalTestCase { + use VerifyDeprecations; + /** * {@inheritDoc} */ @@ -43,5 +46,6 @@ public function testMergingOfEntityWithCompositeIdentifierContainingToOneAssocia $this->assertNotSame($state, $merged); $this->assertInstanceOf(Country::class, $merged->country); $this->assertNotSame($country, $merged->country); + $this->assertHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/MergeProxiesTest.php b/tests/Doctrine/Tests/ORM/Functional/MergeProxiesTest.php index 3d0acd1f898..e323a190711 100644 --- a/tests/Doctrine/Tests/ORM/Functional/MergeProxiesTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/MergeProxiesTest.php @@ -11,9 +11,12 @@ use Doctrine\ORM\Tools\SchemaTool; use Doctrine\Tests\Models\Generic\DateTimeModel; use Doctrine\Tests\OrmFunctionalTestCase; +use Doctrine\Tests\VerifyDeprecations; class MergeProxiesTest extends OrmFunctionalTestCase { + use VerifyDeprecations; + /** * {@inheritDoc} */ @@ -24,6 +27,12 @@ protected function setUp() parent::setUp(); } + /** @after */ + public function ensureTestGeneratedDeprecationMessages() : void + { + $this->assertHasDeprecationMessages(); + } + /** * @group DDC-1392 * @group DDC-1734 diff --git a/tests/Doctrine/Tests/ORM/Functional/MergeSharedEntitiesTest.php b/tests/Doctrine/Tests/ORM/Functional/MergeSharedEntitiesTest.php index b549a420108..3e2937eda99 100644 --- a/tests/Doctrine/Tests/ORM/Functional/MergeSharedEntitiesTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/MergeSharedEntitiesTest.php @@ -4,9 +4,12 @@ use Doctrine\ORM\Tools\ToolsException; use Doctrine\Tests\OrmFunctionalTestCase; +use Doctrine\Tests\VerifyDeprecations; class MergeSharedEntitiesTest extends OrmFunctionalTestCase { + use VerifyDeprecations; + /** * {@inheritDoc} */ @@ -25,6 +28,12 @@ protected function setUp() } } + /** @after */ + public function ensureTestGeneratedDeprecationMessages() : void + { + $this->assertHasDeprecationMessages(); + } + public function testMergeSharedNewEntities() { $file = new MSEFile; diff --git a/tests/Doctrine/Tests/ORM/Functional/MergeVersionedManyToOneTest.php b/tests/Doctrine/Tests/ORM/Functional/MergeVersionedManyToOneTest.php index 43af6720c83..18e061a45e2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/MergeVersionedManyToOneTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/MergeVersionedManyToOneTest.php @@ -5,12 +5,15 @@ use Doctrine\Tests\Models\VersionedManyToOne\Article; use Doctrine\Tests\Models\VersionedManyToOne\Category; use Doctrine\Tests\OrmFunctionalTestCase; +use Doctrine\Tests\VerifyDeprecations; /** * @group MergeVersionedOneToMany */ class MergeVersionedManyToOneTest extends OrmFunctionalTestCase { + use VerifyDeprecations; + protected function setUp() { $this->useModelSet('versioned_many_to_one'); @@ -40,5 +43,6 @@ public function testSetVersionOnCreate() $this->_em->flush(); $this->assertEquals(2, $articleMerged->version); + $this->assertHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php b/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php index c88eff4ab70..e88733d7db5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php @@ -83,7 +83,7 @@ public function testEntityWithIdentifier() $this->assertInstanceOf(CmsUserProxy::class, $uninitializedProxy); $this->_em->persist($uninitializedProxy); - $this->_em->flush($uninitializedProxy); + $this->_em->flush(); $this->assertFalse($uninitializedProxy->__isInitialized(), 'Proxy didn\'t get initialized during flush operations'); $this->assertEquals($userId, $uninitializedProxy->getId()); $this->_em->remove($uninitializedProxy); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php index 8478a5f66d6..f1685d60941 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php @@ -9,12 +9,15 @@ use Doctrine\Tests\Models\DDC117\DDC117ApproveChanges; use Doctrine\Tests\Models\DDC117\DDC117Editor; use Doctrine\Tests\Models\DDC117\DDC117Link; +use Doctrine\Tests\VerifyDeprecations; /** * @group DDC-117 */ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase { + use VerifyDeprecations; + private $article1; private $article2; private $reference; @@ -435,11 +438,12 @@ public function testMergeForeignKeyIdentifierEntity() $refRep = $this->_em->find(DDC117Reference::class, $idCriteria); - $this->_em->detach($refRep); + $this->_em->clear(DDC117Reference::class); $refRep = $this->_em->merge($refRep); $this->assertEquals($this->article1->id(), $refRep->source()->id()); $this->assertEquals($this->article2->id(), $refRep->target()->id()); + $this->assertHasDeprecationMessages(); } /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1276Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1276Test.php index eeaa870ae4d..d340746863d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1276Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1276Test.php @@ -4,12 +4,15 @@ use Doctrine\Tests\Models\CMS\CmsGroup; use Doctrine\Tests\Models\CMS\CmsUser; +use Doctrine\Tests\VerifyDeprecations; /** * @group DDC-1276 */ class DDC1276Test extends \Doctrine\Tests\OrmFunctionalTestCase { + use VerifyDeprecations; + public function setUp() { $this->useModelSet('cms'); @@ -43,5 +46,6 @@ public function testIssue() $this->assertEquals(2, count($user->groups)); $this->_em->flush(); + $this->assertHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php index 7a13d7ac9bc..ca75f905508 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php @@ -2,11 +2,15 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; +use Doctrine\Tests\VerifyDeprecations; + /** * @group DDC-1383 */ class DDC1383Test extends \Doctrine\Tests\OrmFunctionalTestCase { + use VerifyDeprecations; + protected function setUp() { parent::setUp(); @@ -47,6 +51,7 @@ public function testFailingCase() // Parent is NOT instance of entity self::assertTrue($parent instanceof DDC1383Entity, "Entity class is " . get_class($parent) . ', "DDC1383Entity" was expected'); + $this->assertHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1392Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1392Test.php index 806e61de4da..b872e413b50 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1392Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1392Test.php @@ -3,12 +3,15 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\ORM\UnitOfWork; +use Doctrine\Tests\VerifyDeprecations; /** * @group DDC-1392 */ class DDC1392Test extends \Doctrine\Tests\OrmFunctionalTestCase { + use VerifyDeprecations; + protected function setUp() { parent::setUp(); @@ -61,6 +64,7 @@ public function testFailingCase() $result = $q->getSingleScalarResult(); self::assertEquals(1, $result); + $this->assertHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php index 17cfdf78dc7..a2f9c1904a9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php @@ -2,11 +2,14 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; +use Doctrine\Tests\VerifyDeprecations; + /** * @group DDC-1509 */ class DDC1509Test extends \Doctrine\Tests\OrmFunctionalTestCase { + use VerifyDeprecations; protected function setUp() { @@ -48,6 +51,7 @@ public function testFailingCase() $this->assertNotNull($pic->getThumbnail()); $this->assertNotNull($pic->getFile()); + $this->assertHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1594Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1594Test.php index 0c94f73d54c..00cd70a3c09 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1594Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1594Test.php @@ -3,12 +3,15 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Tests\Models\CMS\CmsUser; +use Doctrine\Tests\VerifyDeprecations; /** * @group DDC-1594 */ class DDC1594Test extends \Doctrine\Tests\OrmFunctionalTestCase { + use VerifyDeprecations; + public function setUp() { $this->useModelSet('cms'); @@ -37,5 +40,6 @@ public function testIssue() $this->assertNotSame($mergedUser, $detachedUser); $this->assertEquals('bar', $detachedUser->getName()); $this->assertEquals('bar', $mergedUser->getName()); + $this->assertHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1734Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1734Test.php index cfca544ae81..64199eb07c0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1734Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1734Test.php @@ -4,9 +4,12 @@ use Doctrine\ORM\Proxy\Proxy; use Doctrine\Tests\Models\CMS\CmsGroup; +use Doctrine\Tests\VerifyDeprecations; class DDC1734Test extends \Doctrine\Tests\OrmFunctionalTestCase { + use VerifyDeprecations; + /** * {@inheritDoc} */ @@ -16,6 +19,12 @@ protected function setUp() parent::setUp(); } + /** @after */ + public function ensureTestGeneratedDeprecationMessages() : void + { + $this->assertHasDeprecationMessages(); + } + /** * This test is DDC-1734 minus the serialization, i.e. it works * diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php index 4856852ecaa..99b2ade0f0b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php @@ -26,7 +26,7 @@ public function testDetachedEntityAsId() $entity = new DDC2106Entity(); $this->_em->persist($entity); $this->_em->flush(); - $this->_em->detach($entity); + $this->_em->clear(DDC2106Entity::class); $entity = $this->_em->getRepository(DDC2106Entity::class)->findOneBy([]); // ... and a managed entity without id diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2230Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2230Test.php index 4ced4df4dc7..d68fd8a52e9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2230Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2230Test.php @@ -7,12 +7,15 @@ use Doctrine\Common\Proxy\Proxy; use Doctrine\ORM\Tools\ToolsException; use Doctrine\Tests\OrmFunctionalTestCase; +use Doctrine\Tests\VerifyDeprecations; /** * @group DDC-2230 */ class DDC2230Test extends OrmFunctionalTestCase { + use VerifyDeprecations; + protected function setUp() { parent::setUp(); @@ -48,6 +51,7 @@ public function testNotifyTrackingNotCalledOnUninitializedProxies() $this->assertInstanceOf(Proxy::class, $address); $this->assertFalse($address->__isInitialized()); + $this->assertHasDeprecationMessages(); } public function testNotifyTrackingCalledOnProxyInitialization() @@ -67,6 +71,7 @@ public function testNotifyTrackingCalledOnProxyInitialization() $addressProxy->__load(); $this->assertSame($this->_em->getUnitOfWork(), $addressProxy->listener); + $this->assertNotHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2409Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2409Test.php index 94d39b99446..aa44bbaee6b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2409Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2409Test.php @@ -5,12 +5,15 @@ use Doctrine\ORM\UnitOfWork; use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Tests\Models\CMS\CmsArticle; +use Doctrine\Tests\VerifyDeprecations; /** * @group DDC-2409 */ class DDC2409Test extends \Doctrine\Tests\OrmFunctionalTestCase { + use VerifyDeprecations; + public function setUp() { $this->useModelSet('cms'); @@ -53,8 +56,8 @@ public function testIssue() $this->assertEquals(UnitOfWork::STATE_MANAGED, $uow->getEntityState($article)); $this->assertEquals(UnitOfWork::STATE_NEW, $uow->getEntityState($user)); - $em->detach($user); - $em->detach($article); + $em->clear(CmsUser::class); + $em->clear(CmsArticle::class); $userMerged = $em->merge($user); $articleMerged = $em->merge($article); @@ -68,5 +71,6 @@ public function testIssue() $this->assertNotSame($article, $articleMerged); $this->assertNotSame($userMerged, $articleMerged->user); $this->assertSame($user, $articleMerged->user); + $this->assertHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2645Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2645Test.php index d6a77f7db37..e71de5b3f0a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2645Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2645Test.php @@ -2,11 +2,15 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; +use Doctrine\Tests\VerifyDeprecations; + /** * @group DDC-2645 */ class DDC2645Test extends \Doctrine\Tests\OrmFunctionalTestCase { + use VerifyDeprecations; + public function testIssue() { $bar = new DDC2645Bar; @@ -22,6 +26,7 @@ public function testIssue() $this->assertSame($foo, $foo3); $this->assertEquals('Bar', $foo->name); + $this->assertHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2790Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2790Test.php index ee2668931c0..0f3efab262c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2790Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2790Test.php @@ -45,7 +45,7 @@ public function testIssue() // (and consequently also triggers preUpdate/postUpdate for the entity in question) $entity->name = 'Robin'; - $this->_em->flush($entity); + $this->_em->flush(); $qb = $this->_em->createQueryBuilder(); $qb->from(get_class($entity), 'c'); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2984Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2984Test.php index 69f4d01c0c5..e21ac82dc87 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2984Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2984Test.php @@ -40,7 +40,7 @@ public function testIssue() $user->applyName('Alex'); $this->_em->persist($user); - $this->_em->flush($user); + $this->_em->flush(); $repository = $this->_em->getRepository(__NAMESPACE__ . "\DDC2984User"); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3699Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3699Test.php index fd284e5b11d..8d3607112e2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3699Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3699Test.php @@ -3,12 +3,15 @@ use Doctrine\Tests\Models\DDC3699\DDC3699RelationOne; use Doctrine\Tests\Models\DDC3699\DDC3699RelationMany; use Doctrine\Tests\Models\DDC3699\DDC3699Child; +use Doctrine\Tests\VerifyDeprecations; /** * @group DDC-3699 */ class DDC3597Test extends \Doctrine\Tests\OrmFunctionalTestCase { + use VerifyDeprecations; + protected function setUp() { $this->useModelSet('ddc3699'); @@ -16,6 +19,12 @@ protected function setUp() parent::setUp(); } + /** @after */ + public function ensureTestGeneratedDeprecationMessages() : void + { + $this->assertHasDeprecationMessages(); + } + /** * @group DDC-3699 */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3711Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3711Test.php index bd2b1ba9bc6..dc633c7aa88 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3711Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3711Test.php @@ -6,12 +6,15 @@ use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\Tests\Models\DDC3711\DDC3711EntityA; use Doctrine\Tests\ORM\Mapping\YamlMappingDriverTest; +use Doctrine\Tests\VerifyDeprecations; /** * @author Marc Pantel */ class DDC3711Test extends YamlMappingDriverTest { + use VerifyDeprecations; + public function testCompositeKeyForJoinTableInManyToManyCreation() { $yamlDriver = $this->_loadDriver(); @@ -26,5 +29,6 @@ public function testCompositeKeyForJoinTableInManyToManyCreation() $this->assertEquals(['link_a_id1' => "id1", 'link_a_id2' => "id2"], $entityA->associationMappings['entityB']['relationToSourceKeyColumns']); $this->assertEquals(['link_b_id1' => "id1", 'link_b_id2' => "id2"], $entityA->associationMappings['entityB']['relationToTargetKeyColumns']); + $this->assertHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php index 5b2996aab2f..14c8be412cb 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php @@ -5,6 +5,7 @@ use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Tests\Models\CMS\CmsGroup; use Doctrine\Tests\Models\CMS\CmsPhonenumber; +use Doctrine\Tests\VerifyDeprecations; /** * ----------------- !! NOTE !! -------------------- @@ -19,6 +20,8 @@ */ class DDC501Test extends OrmFunctionalTestCase { + use VerifyDeprecations; + protected function setUp() { $this->useModelSet('cms'); @@ -80,6 +83,7 @@ public function testMergeUnitializedManyToManyAndOneToManyCollections() // This works fine as long as cmUser::groups doesn't cascade "merge" // Otherwise group memberships are physically deleted now! $this->assertEquals(2, count($userClone->getGroups())); + $this->assertHasDeprecationMessages(); } protected function createAndPersistUser() diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC518Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC518Test.php index 073bb335188..64749876b8c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC518Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC518Test.php @@ -2,8 +2,12 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; +use Doctrine\Tests\VerifyDeprecations; + class DDC518Test extends \Doctrine\Tests\OrmFunctionalTestCase { + use VerifyDeprecations; + public function setUp() { $this->useModelSet('cms'); @@ -31,5 +35,6 @@ public function testMergeWithRelatedNew() $managedArticle = $this->_em->merge($article); $this->assertSame($article->user, $managedArticle->user); + $this->assertHasDeprecationMessages(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php index af4c9634c12..8cc9642100d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php @@ -4,9 +4,12 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\PersistentCollection; +use Doctrine\Tests\VerifyDeprecations; class DDC729Test extends \Doctrine\Tests\OrmFunctionalTestCase { + use VerifyDeprecations; + public function setUp() { parent::setUp(); @@ -24,6 +27,12 @@ public function setUp() } } + /** @after */ + public function ensureTestGeneratedDeprecationMessages() : void + { + $this->assertHasDeprecationMessages(); + } + public function testMergeManyToMany() { $a = new DDC729A(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC758Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC758Test.php index a5707f233e3..e7a36310ed6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC758Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC758Test.php @@ -5,9 +5,11 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Tests\Models\CMS\CmsGroup; +use Doctrine\Tests\VerifyDeprecations; class DDC758Test extends \Doctrine\Tests\OrmFunctionalTestCase { + use VerifyDeprecations; public function setUp() { @@ -17,6 +19,12 @@ public function setUp() parent::setUp(); } + /** @after */ + public function ensureTestGeneratedDeprecationMessages() : void + { + $this->assertHasDeprecationMessages(); + } + /** * Helper method to set cascade to merge only */ diff --git a/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php b/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php index ff5de971acd..7a483ebc783 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php @@ -141,7 +141,7 @@ public function testDqlOnEmbeddedObjectsField() $person = new DDC93Person('Johannes', new DDC93Address('Moo', '12345', 'Karlsruhe', new DDC93Country('Germany'))); $this->_em->persist($person); - $this->_em->flush($person); + $this->_em->flush(); // SELECT $selectDql = "SELECT p FROM " . __NAMESPACE__ ."\\DDC93Person p WHERE p.address.city = :city AND p.address.country.name = :country"; @@ -184,7 +184,7 @@ public function testPartialDqlOnEmbeddedObjectsField() { $person = new DDC93Person('Karl', new DDC93Address('Foo', '12345', 'Gosport', new DDC93Country('England'))); $this->_em->persist($person); - $this->_em->flush($person); + $this->_em->flush(); $this->_em->clear(); // Prove that the entity was persisted correctly. @@ -254,7 +254,7 @@ public function testEmbeddableWithInheritance() { $car = new DDC93Car(new DDC93Address('Foo', '12345', 'Asdf')); $this->_em->persist($car); - $this->_em->flush($car); + $this->_em->flush(); $reloadedCar = $this->_em->find(DDC93Car::class, $car->id); $this->assertEquals($car, $reloadedCar); diff --git a/tests/Doctrine/Tests/ORM/Mapping/Symfony/YamlDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/Symfony/YamlDriverTest.php index f9c8a839b04..d74677fc7d7 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/Symfony/YamlDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/Symfony/YamlDriverTest.php @@ -3,12 +3,15 @@ namespace Doctrine\Tests\ORM\Mapping\Symfony; use \Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver; +use Doctrine\Tests\VerifyDeprecations; /** * @group DDC-1418 */ class YamlDriverTest extends AbstractDriverTest { + use VerifyDeprecations; + protected function getFileExtension() { return '.orm.yml'; @@ -17,6 +20,7 @@ protected function getFileExtension() protected function getDriver(array $paths = []) { $driver = new SimplifiedYamlDriver(array_flip($paths)); + $this->expectDeprecationMessage('YAML mapping driver is deprecated and will be removed in Doctrine 3.0, please migrate to annotation or XML driver.'); return $driver; } diff --git a/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php index b6feb405290..d34460d268d 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php @@ -8,10 +8,13 @@ use Doctrine\Tests\Models\DirectoryTree\Directory; use Doctrine\Tests\Models\DirectoryTree\File; use Doctrine\Tests\Models\Generic\SerializationModel; +use Doctrine\Tests\VerifyDeprecations; use Symfony\Component\Yaml\Yaml; class YamlMappingDriverTest extends AbstractMappingDriverTest { + use VerifyDeprecations; + protected function _loadDriver() { if (!class_exists(Yaml::class, true)) { @@ -43,6 +46,7 @@ public function testJoinTablesWithMappedSuperclassForYamlDriver() $classDirectory = new ClassMetadata(Directory::class); $classDirectory = $factory->getMetadataFor(Directory::class); $this->assertEquals(Directory::class, $classDirectory->associationMappings['parentDirectory']['sourceEntity']); + $this->assertHasDeprecationMessages(); } /** @@ -76,6 +80,13 @@ public function testSpacesShouldBeIgnoredWhenUseExplode() $this->assertEquals(255, $nameField['length']); $this->assertEquals(255, $valueField['length']); + $this->assertHasDeprecationMessages(); + } + + public function testDeprecation() : void + { + $this->createClassMetadata(DDC2069Entity::class); + $this->expectDeprecationMessage('YAML mapping driver is deprecated and will be removed in Doctrine 3.0, please migrate to annotation or XML driver.'); } } diff --git a/tests/Doctrine/Tests/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommandTest.php b/tests/Doctrine/Tests/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommandTest.php index 3e6a0e90486..f21a9a64d3a 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommandTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommandTest.php @@ -5,10 +5,19 @@ use Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand; use Doctrine\ORM\Tools\EntityGenerator; use Doctrine\Tests\OrmTestCase; +use Doctrine\Tests\VerifyDeprecations; use Symfony\Component\Console\Output\OutputInterface; class ConvertDoctrine1SchemaCommandTest extends OrmTestCase { + use VerifyDeprecations; + + /** @after */ + public function ensureTestGeneratedDeprecationMessages() : void + { + $this->assertHasDeprecationMessages(); + } + public function testExecution() { $entityGenerator = $this->createMock(EntityGenerator::class); diff --git a/tests/Doctrine/Tests/ORM/Tools/Console/Command/GenerateRepositoriesCommandTest.php b/tests/Doctrine/Tests/ORM/Tools/Console/Command/GenerateRepositoriesCommandTest.php index 74fbc38b22b..cd05da25ec6 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Console/Command/GenerateRepositoriesCommandTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Console/Command/GenerateRepositoriesCommandTest.php @@ -10,12 +10,14 @@ use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper; use Doctrine\Tests\Models\DDC3231\DDC3231EntityRepository; use Doctrine\Tests\OrmFunctionalTestCase; +use Doctrine\Tests\VerifyDeprecations; use Symfony\Component\Console\Application; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Tester\CommandTester; class GenerateRepositoriesCommandTest extends OrmFunctionalTestCase { + use VerifyDeprecations; /** * @var \Symfony\Component\Console\Application */ @@ -89,6 +91,7 @@ public function testGenerateRepositories() self::assertSame(EntityRepository::class, $repo1->getParentClass()->getName()); self::assertSame(EntityRepository::class, $repo2->getParentClass()->getName()); + $this->assertHasDeprecationMessages(); } public function testGenerateRepositoriesCustomDefaultRepository() @@ -112,6 +115,7 @@ public function testGenerateRepositoriesCustomDefaultRepository() self::assertSame(DDC3231EntityRepository::class, $repo1->getParentClass()->getName()); self::assertSame(DDC3231EntityRepository::class, $repo2->getParentClass()->getName()); + $this->assertHasDeprecationMessages(); } /** @@ -168,6 +172,7 @@ public function testNoMetadataClassesToProcess() : void ] ); + self::assertContains('Command orm:generate-repositories is deprecated and will be removed in Doctrine 3.0.', $tester->getDisplay()); self::assertContains('[OK] No Metadata Classes to process.', $tester->getDisplay()); } } diff --git a/tests/Doctrine/Tests/ORM/Tools/ConvertDoctrine1SchemaTest.php b/tests/Doctrine/Tests/ORM/Tools/ConvertDoctrine1SchemaTest.php index ca6192faa29..291228687fb 100644 --- a/tests/Doctrine/Tests/ORM/Tools/ConvertDoctrine1SchemaTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/ConvertDoctrine1SchemaTest.php @@ -13,6 +13,7 @@ use Doctrine\Common\EventManager; use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory; use Doctrine\Tests\OrmTestCase; +use Doctrine\Tests\VerifyDeprecations; /** * Test case for converting a Doctrine 1 style schema to Doctrine 2 mapping files @@ -26,6 +27,8 @@ */ class ConvertDoctrine1SchemaTest extends OrmTestCase { + use VerifyDeprecations; + protected function _createEntityManager($metadataDriver) { $driverMock = new DriverMock(); @@ -77,6 +80,7 @@ public function testTest() $this->assertEquals('User', $profileClass->associationMappings['User']['targetEntity']); $this->assertEquals('username', $userClass->table['uniqueConstraints']['username']['columns'][0]); + $this->assertHasDeprecationMessages(); } public function tearDown() diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php index 42d62513b70..25518691538 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php @@ -12,9 +12,11 @@ use Doctrine\Tests\Models\DDC2372\DDC2372Admin; use Doctrine\Tests\Models\DDC2372\DDC2372User; use Doctrine\Tests\OrmTestCase; +use Doctrine\Tests\VerifyDeprecations; class EntityGeneratorTest extends OrmTestCase { + use VerifyDeprecations; /** * @var EntityGenerator @@ -49,6 +51,12 @@ public function tearDown() rmdir($this->_tmpDir . '/' . $this->_namespace); } + /** @after */ + public function ensureTestGeneratedDeprecationMessages() : void + { + $this->assertHasDeprecationMessages(); + } + /** * @param ClassMetadataInfo[] $embeddedClasses * diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php index feff13dc066..d020cc6e07c 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php @@ -10,9 +10,12 @@ use Doctrine\Tests\Models\DDC3231\DDC3231User1; use Doctrine\Tests\Models\DDC3231\DDC3231User2; use Doctrine\Tests\OrmTestCase; +use Doctrine\Tests\VerifyDeprecations; class EntityRepositoryGeneratorTest extends OrmTestCase { + use VerifyDeprecations; + /** * @var EntityGenerator */ @@ -70,6 +73,12 @@ public function tearDown() } } + /** @after */ + public function ensureTestGeneratedDeprecationMessages() : void + { + $this->assertHasDeprecationMessages(); + } + /** * @group DDC-3231 */ diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php index a74af72a17f..84ddd011f6a 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php @@ -19,6 +19,7 @@ use Doctrine\Tests\Mocks\DriverMock; use Doctrine\Tests\Mocks\EntityManagerMock; use Doctrine\Tests\OrmTestCase; +use Doctrine\Tests\VerifyDeprecations; use Symfony\Component\Yaml\Parser; /** @@ -33,6 +34,8 @@ */ abstract class AbstractClassMetadataExporterTest extends OrmTestCase { + use VerifyDeprecations; + protected $_extension; abstract protected function _getType(); @@ -115,6 +118,8 @@ public function testExportDirectoryAndFilesAreCreated() } else { $this->assertTrue(file_exists(__DIR__ . '/export/' . $type . '/Doctrine.Tests.ORM.Tools.Export.ExportedUser'.$this->_extension)); } + + $this->assertHasDeprecationMessages(); } /** diff --git a/tests/Doctrine/Tests/ORM/Tools/SetupTest.php b/tests/Doctrine/Tests/ORM/Tools/SetupTest.php index c7ec7c6d191..3678a4cf4ce 100644 --- a/tests/Doctrine/Tests/ORM/Tools/SetupTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/SetupTest.php @@ -11,9 +11,12 @@ use Doctrine\ORM\Tools\Setup; use Doctrine\ORM\Version; use Doctrine\Tests\OrmTestCase; +use Doctrine\Tests\VerifyDeprecations; class SetupTest extends OrmTestCase { + use VerifyDeprecations; + private $originalAutoloaderCount; private $originalIncludePath; @@ -74,6 +77,7 @@ public function testYAMLConfiguration() $this->assertInstanceOf(Configuration::class, $config); $this->assertInstanceOf(YamlDriver::class, $config->getMetadataDriverImpl()); + $this->assertHasDeprecationMessages(); } /** From f9a4258dedd6b4e9885e096dc6f5af73866a693a Mon Sep 17 00:00:00 2001 From: Michael Moravec Date: Sun, 17 Dec 2017 05:02:07 +0100 Subject: [PATCH 4/4] Upgrading notes for 2.7 --- UPGRADE.md | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/UPGRADE.md b/UPGRADE.md index 18b74ce9379..9a54315bba3 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,103 @@ # Upgrade to 2.7 +## Deprecated code generators and related console commands + +These console commands have been deprecated: + + * `orm:convert-mapping` + * `orm:generate:entities` + * `orm:generate-repositories` + +These classes have been deprecated: + + * `Doctrine\ORM\Tools\EntityGenerator` + * `Doctrine\ORM\Tools\EntityRepositoryGenerator` + +Whole Doctrine\ORM\Tools\Export namespace with all its members have been deprecated as well. + +## Deprecated `Doctrine\ORM\Proxy\Proxy` marker interface + +Proxy objects in Doctrine 3.0 will no longer implement `Doctrine\ORM\Proxy\Proxy` nor +`Doctrine\Common\Persistence\Proxy`: instead, they implement +`ProxyManager\Proxy\GhostObjectInterface`. + +These related classes have been deprecated: + + * `Doctrine\ORM\Proxy\ProxyFactory` + * `Doctrine\ORM\Proxy\Autoloader` - we suggest using the composer autoloader instead + +These methods have been deprecated: + + * `Doctrine\ORM\Configuration#getAutoGenerateProxyClasses()` + * `Doctrine\ORM\Configuration#getProxyDir()` + * `Doctrine\ORM\Configuration#getProxyNamespace()` + +## Deprecated `Doctrine\ORM\Version` + +The `Doctrine\ORM\Version` class is now deprecated and will be removed in Doctrine 3.0: +please refrain from checking the ORM version at runtime or use +[Ocramius/PackageVersions](https://github.com/Ocramius/PackageVersions/). + +## Deprecated `EntityManager#merge()` and `EntityManager#detach()` methods + +Merge and detach semantics were a poor fit for the PHP "share-nothing" architecture. +In addition to that, merging/detaching caused multiple issues with data integrity +in the managed entity graph, which was constantly spawning more edge-case bugs/scenarios. + +The following API methods were therefore deprecated: + +* `EntityManager#merge()` +* `EntityManager#detach()` +* `UnitOfWork#merge()` +* `UnitOfWork#detach()` + +Users are encouraged to migrate `EntityManager#detach()` calls to `EntityManager#clear()`. + +In order to maintain performance on batch processing jobs, it is endorsed to enable +the second level cache (http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/second-level-cache.html) +on entities that are frequently reused across multiple `EntityManager#clear()` calls. + +An alternative to `EntityManager#merge()` will not be provided by ORM 3.0, since the merging +semantics should be part of the business domain rather than the persistence domain of an +application. If your application relies heavily on CRUD-alike interactions and/or `PATCH` +restful operations, you should look at alternatives such as [JMSSerializer](https://github.com/schmittjoh/serializer). + +## Extending `EntityManager` is deprecated + +Final keyword will be added to the `EntityManager::class` in Doctrine 3.0 in order to ensure that EntityManager + is not used as valid extension point. Valid extension point should be EntityManagerInterface. + +## Deprecated `EntityManager#flush($entity)` and `EntityManager#flush($entities)` + +If your code relies on single entity flushing optimisations via +`EntityManager#flush($entity)`, the signature has been changed to +`EntityManager#flush()`. + +Said API was affected by multiple data integrity bugs due to the fact +that change tracking was being restricted upon a subset of the managed +entities. The ORM cannot support committing subsets of the managed +entities while also guaranteeing data integrity, therefore this +utility was removed. + +The `flush()` semantics will remain the same, but the change tracking will be performed +on all entities managed by the unit of work, and not just on the provided +`$entity` or `$entities`, as the parameter is now completely ignored. + +The same applies to `UnitOfWork#commit($entity)`, which will simply be +`UnitOfWork#commit()`. + +If you would still like to perform batching operations over small `UnitOfWork` +instances, it is suggested to follow these paths instead: + + * eagerly use `EntityManager#clear()` in conjunction with a specific second level + cache configuration (see http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/second-level-cache.html) + * use an explicit change tracking policy (see http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/change-tracking-policies.html) + +## Deprecated `YAML` mapping drivers. + +If your code relies on `YamlDriver` or `SimpleYamlDriver`, you **MUST** change to +annotation or XML drivers instead. + ## Deprecated: `Doctrine\ORM\EntityManagerInterface#copy()` Method `Doctrine\ORM\EntityManagerInterface#copy()` never got its implementation and is deprecated.