Skip to content

Added deprecation warnings for 2.x#6869

Closed
Majkl578 wants to merge 7 commits intodoctrine:2.7from
Majkl578:deprecations-2.x
Closed

Added deprecation warnings for 2.x#6869
Majkl578 wants to merge 7 commits intodoctrine:2.7from
Majkl578:deprecations-2.x

Conversation

@Majkl578
Copy link
Copy Markdown
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
"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
Copy Markdown
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.

*/
public function flush($entity = null)
{
if (func_num_args() === 1) {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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().

*/
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
Copy Markdown
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
Copy Markdown
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.

*/
public function flush($entity = null)
{
if (func_num_args() === 1) {
Copy link
Copy Markdown
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

* @author Roman Borschel <roman@code-factory.org>
* @since 2.0
*
* @deprecated This class is deprecated and will be removed in Doctrine 3.0, proxies will no longer implement it.
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Majkl578 commented Dec 11, 2017

Updated, added deprecations for codegen (#6870).

@Majkl578
Copy link
Copy Markdown
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
Copy Markdown
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?

*
* @return string|null
*
* @deprecated
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Rebased.

@hkdobrev
Copy link
Copy Markdown
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