Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Translation] added method to expose collected message#9859
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Grygir commentedDec 25, 2013
| Q | A |
|---|---|
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | no |
| Fixed tickets | #2435 |
| License | MIT |
| Doc PR | symfony/symfony-docs#3386 |
jakzal commentedDec 26, 2013
@Grygir there's no need to create a new PR. You could've just pushed to your branch and PR would be updated. You have to merge master into your branch and resolve conflicts. Please add a PR description with a table. |
Grygir commentedDec 26, 2013
@jakzal thanks. That was a bit misunderstanding from my side. I've applied all changes for comments from#8597 and created a paragraph insymfony/symfony-docs#3386. |
fabpot commentedDec 28, 2013
@Grygir You should remove the merge commit (squashing you commits would help here). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Should be something like:Collects all messages.
Grygir commentedJan 8, 2014
@fabpot thanks, all commented issues are fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
is it a good idea to do it with for? not foreach? You have flipped$domains and left$catalogues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
$domains is usually small array (several items) and$catalogues is often quite big. So thefor-loop is used here (instead ofarray_flip +foreach-loop) in only matter of performance.
aitboudad commentedJan 14, 2014
You should update the CHANGELOG file (in the component dir) |
Grygir commentedJan 15, 2014
@aitboudad, do I understand correctly, this note should be in a section related to the coming version (2.5.0)? |
aitboudad commentedJan 15, 2014
Grygir commentedJan 15, 2014
@aitboudad, done, thanks |
wouterj commentedJul 24, 2014
Grygir commentedJul 24, 2014
@wouterj pull request is updated, thanks |
wouterj commentedJul 24, 2014
👍 great! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't really like theexposeMessages() name. What about justgetMessages()?
Grygir commentedJul 24, 2014
@fabpot thank you, all comments are fixed (related symfony-docs pull request is updated as well) |
fabpot commentedJul 24, 2014
👍 |
wouterj commentedJul 24, 2014
Great work,@fabpot, nice to see this one picked up that fast! |
sstok commentedJul 24, 2014
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't see any difference between passingarray() andnull for domains. Then I would just usearray $domains = array() without null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I see@fabpot suggested that. But I don't agree with that. First of all, it makes the argument type dynamic and secondly, there is no semantic difference.
So when you see code like
$translator->getMessages(array());$translator->getMessages(null);you would think both do something different and look at the implementation what the difference is. But in fact it's the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Whatever. Usearray() if you want to, I don't really care.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please note what the default means: every domain. It seems wrong to use every domain if you pass an empty list. Null stands for no argument, if you pass no argument to domain, it seems logical to get all domains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@wouterj It's perfectly right to get every domain if you pass an empty list. The argument filters the required domains (see phpdoc), i.e. an empty filter will return everything. Pretty logical.
Btw, it's the same as inRoute::setSchemes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
What I also find bad is that you can get all messages for all domains, but not for all locales.
I'd propose to simply remove the domains parameter. The logic that it implements can simply be done by the user. And the method should only have a single responsibility, and that is not filtering domains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@Tobion Frankly, don't see anything bad of allowing to filter messages at the fetch method. It looks natural for me. Confident, that other developers will find it usefull.
Regarding "null vs.array()", I'm like 45/55. Your argument
to get every domain if you pass an empty list.
seems reasonable for me. That's how most UI filters works "empty filter list --> all records". That's why, have implemented it this way first time. But, really don't see a big deal to usenull for all messages. There's only matter of integrity and consistency, and IMHOarray() fits more those requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yes it might be useful, but everything is useful for someone. The point is,
- it violates single responsibility
- is really simply to do in user-land, just `$messages['mydomain']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@Tobion, you are definitely right. It won't be hard to pick proper domains by array's keys in afterwords. I've updated the method, the test and documentation as well.
Thank you.
wouterj commentedJul 25, 2014
👍 thanks@Grygir (although I have no vote permission) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Missing description that it returnsarray[array] indexed by catalog.
Tobion commentedAug 16, 2014
Apart from the phpdoc above, 👍 |
Grygir commentedAug 18, 2014
@Tobion, thank you. Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Why is this calculated instead of setting the value explicitly in the data provider?
fabpot commentedAug 27, 2014
Thank you@Grygir. |
…(Grygir)This PR was merged into the 2.6-dev branch.Discussion----------[Translation] added method to expose collected message| Q | A| ------------- | ---| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | no| Fixed tickets |#2435| License | MIT| Doc PR |symfony/symfony-docs#3386Commits-------ef5d7c5 [Translation] added method to expose collected messages
…(Grygir)This PR was merged into the master branch.Discussion----------[Translation] added method to expose collected message| Q | A| ------------- | ---| Doc fix? | no| New docs? | yes (symfony/symfony#9859)| Applies to | all (or 2.4+)| Fixed tickets |Commits-------f701f73 [Translation] added method to expose collected message