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

Added deprecation warnings for 2.x #6869

Closed
wants to merge 7 commits into from

Conversation

Majkl578
Copy link
Contributor

@Majkl578 Majkl578 commented Dec 8, 2017

Based on UPGRADE document for 3.0.

Deprecations added for:

  • EntityManager::copy() method
  • EntityManager::merge() method
  • EntityManager::detach() method
  • EntityManager::flush() calls with arguments
  • YAML mapping driver
  • Version class
  • Proxy interface
  • Configuration::getProxy*()
  • ProxyFactory
  • proxy Autoloader

I have not added any notes about mapping/metadata changes here because it's still pretty unstable.

Tests marked as @legacy use any of the deprecated methods.
Added explicit deprecation tests for deprecated methods.

I'd like to get these into 2.6, there is no reason to delay it.

composer.json Outdated
@@ -31,7 +31,8 @@
"doctrine/coding-standard": "^1.0",
"phpunit/phpunit": "^6.0",
"squizlabs/php_codesniffer": "^3.1",
"symfony/yaml": "~3.4|~4.0"
"symfony/phpunit-bridge": "^3.3|^4.0",
"symfony/yaml": "4.0.1"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just temporary hack to work around symfony/symfony#25405 on CI.

@@ -353,6 +353,13 @@ public function createQueryBuilder()
*/
public function flush($entity = null)
{
if (func_num_args() === 1) {
Copy link
Member

@greg0ire greg0ire Dec 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using > 0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't $entity !== null simpler? I mean, only the first argument is used anyway

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah even better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would still allow flush(null) though. I'll change it to !== 0.

*/
public function detach($entity)
{
@trigger_error('Method ' . __METHOD__ . '() is deprecated and will be removed in Doctrine 3.0, please migrate to ' . self::class . '::clear().', E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linebreak here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, EntityManager#clear() has a different behaviour... and I'm not even sure if we should point people to do partial cleaning of the UoW, it might have the very same issues we have with EntityManager#detach().

@@ -44,6 +44,8 @@ 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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linebreak?

@lcobucci lcobucci added this to the 2.7.0 milestone Dec 10, 2017
Copy link
Member

@lcobucci lcobucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just some minor comments.

We just need to keep in mind that our plan is to release 2.6 WITHOUT the deprecation notices. 2.7 would be the one adding them.

@@ -353,6 +353,13 @@ public function createQueryBuilder()
*/
public function flush($entity = null)
{
if (func_num_args() === 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't $entity !== null simpler? I mean, only the first argument is used anyway

@@ -26,6 +26,8 @@
*
* @author Roman Borschel <[email protected]>
* @since 2.0
*
* @deprecated This class is deprecated and will be removed in Doctrine 3.0, proxies will no longer implement it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to mention which interface should be used? So that people can already start preparing their stuff

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this one, we would be referencing 3rd party code (ProxyManager) which is not required in Composer.

*/
public function detach($entity)
{
@trigger_error('Method ' . __METHOD__ . '() is deprecated and will be removed in Doctrine 3.0, please migrate to ' . self::class . '::clear().', E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, EntityManager#clear() has a different behaviour... and I'm not even sure if we should point people to do partial cleaning of the UoW, it might have the very same issues we have with EntityManager#detach().

@Majkl578
Copy link
Contributor Author

We just need to keep in mind that our plan is to release 2.6 WITHOUT the deprecation notices.

Well, the sooner we ship them, the better for users, but if there are other reasons, 2.7 is fine by me.

@Majkl578
Copy link
Contributor Author

Majkl578 commented Dec 11, 2017

Updated, added deprecations for codegen (#6870).

@Majkl578
Copy link
Contributor Author

I've also added deprecatons for:

  • Configuration::getProxy*()
  • ProxyFactory
  • proxy Autoloader

Also partially imported UPGRADE notes from develop and reworded them (no mapping-related changes since it's unfinished).

@Majkl578 Majkl578 changed the base branch from master to 2.7 December 17, 2017 04:24
UPGRADE.md Outdated
@@ -1,3 +1,103 @@
# Upgrade to 2.7

## BC Break: Deprecated code generators and related console commands
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecations are not BC-breaks, are they?

@@ -70,6 +70,8 @@ public function setProxyDir($dir)
* Gets the directory where Doctrine generates any necessary proxy class files.
*
* @return string|null
*
* @deprecated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not also trigger a deprecation error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no replacement, it would be an error that cannot be muted/fixed, it would be just annoying without benefit.

@Majkl578 Majkl578 force-pushed the deprecations-2.x branch 2 times, most recently from f74c575 to 0be38dd Compare December 18, 2017 00:46
@Majkl578
Copy link
Contributor Author

Rebased.

@hkdobrev
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants