Skip to content

[Translator] deprecate getMessages in favor of getCatalogue. #14546

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

Merged
merged 1 commit into from
May 6, 2015

Conversation

aitboudad
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Fixed tickets #14529
Tests pass? yes
License MIT

@@ -292,6 +292,8 @@ protected function getLoaders()
*/
public function getMessages($locale = null)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the getCatalogue() method instead.', 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.

I would say Rely on the TranslatorBagInterface instead. The current message saying Use the getCatalogue() method instead is confusing because getCatalogue is not a drop-in replacement for getMessages (it is the more powerful way to implement the feature though)

@stof
Copy link
Member

stof commented May 4, 2015

You need to update the UPGRADE-2.8.md file too, to describe the migration path.

@aitboudad aitboudad force-pushed the translation_dep_messages branch from c3567f8 to 267cf79 Compare May 4, 2015 21:20
@aitboudad
Copy link
Contributor Author

@stof done and I also simplified getMessages see #14549

@aitboudad aitboudad force-pushed the translation_dep_messages branch from 267cf79 to 6cb4f03 Compare May 5, 2015 10:15
@aitboudad
Copy link
Contributor Author

@stof I deprecated loadCatalogue too

@aitboudad aitboudad changed the title [Translator] deprecate getMessages in favor of getCatalogue. [Translator] deprecate getMessages and loadCatalogue in favor of getCatalogue. May 5, 2015
@aitboudad aitboudad force-pushed the translation_dep_messages branch from 6cb4f03 to 472f8b7 Compare May 5, 2015 10:37
$this->initializeCatalogue($locale);
} else {
$this->initializeCacheCatalogue($locale);
}
Copy link
Member

Choose a reason for hiding this comment

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

This change is not BC. People overwriting loadCatalogue would miss their extended behavior after this change (and this is why protected stuff are a pain for BC)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, reverted.

@aitboudad aitboudad force-pushed the translation_dep_messages branch from 472f8b7 to b7035d4 Compare May 5, 2015 12:00
@@ -311,6 +313,8 @@ public function getMessages($locale = null)
*/
protected function loadCatalogue($locale)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Rely on the TranslatorBagInterface instead', 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.

this now triggers deprecations in Symfony itself, which is bad.

what you need to do is to trigger the deprecation in caller places in case the method is overwritten (have a look at the way we did for setDefaultOptions in form types, or for Kernel::init even though this one was simpler as the default method does nothing)

Copy link
Member

Choose a reason for hiding this comment

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

I suggest keeping this PR focused on getMessages only and deal with loadCatalogue later once we have a replacement for the extension point

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sound reasonable

@aitboudad aitboudad force-pushed the translation_dep_messages branch from b7035d4 to 03beebb Compare May 5, 2015 12:23
@aitboudad aitboudad changed the title [Translator] deprecate getMessages and loadCatalogue in favor of getCatalogue. [Translator] deprecate getMessages in favor of getCatalogue. May 5, 2015
@aitboudad aitboudad added the Ready label May 5, 2015
@stof
Copy link
Member

stof commented May 5, 2015

👍

{
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
Copy link
Contributor

Choose a reason for hiding this comment

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

is this still required? I've seen tests without it and sometimes a @group legacy annotation. What exactly is the workflow?

Copy link
Member

Choose a reason for hiding this comment

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

Using the legacy group is sufficient and I suggest to only use that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@xabbuh
Copy link
Member

xabbuh commented May 6, 2015

@aitboudad I don't see where you deprecate the loadCatalogue() method.

@aitboudad aitboudad force-pushed the translation_dep_messages branch from 03beebb to 2869a32 Compare May 6, 2015 09:17
@aitboudad
Copy link
Contributor Author

@xabbuh see #14546 (comment)

@Tobion
Copy link
Contributor

Tobion commented May 6, 2015

👍

@aitboudad aitboudad merged commit 2869a32 into symfony:2.8 May 6, 2015
aitboudad added a commit that referenced this pull request May 6, 2015
…logue. (aitboudad)

This PR was merged into the 2.8 branch.

Discussion
----------

[Translator] deprecate getMessages in favor of getCatalogue.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets  | #14529
| Tests pass?   | yes
| License       | MIT

Commits
-------

2869a32 [Translator] deprecate getMessages in favor of getCatalogue.
@aitboudad aitboudad deleted the translation_dep_messages branch May 6, 2015 11:02
@fabpot fabpot mentioned this pull request Nov 16, 2015
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.

4 participants