-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Conversation
Hello, the feature of rendering is fantastic, but you can not print the current message, this second method would make this work.
@diegobittencourt please provide unit tests |
Doesn't this duplicate functionality we have in the Flash Messenger view helper? http://framework.zend.com/manual/2.2/en/modules/zend.view.helpers.flash-messenger.html |
@tfountain |
I am providing tests for the method I created. |
Tests -> #5759 Please if something is missing or incorrect, show me for me to get. |
you should just add a commit here, make git push to your branch, no need to create new PR, so #5798 can be closed :) |
Hello, I joined the 2 commits into one, I should do something else? |
travis build failure (https://travis-ci.org/zendframework/zf2/jobs/18593426), you need to fix it with php-cs-fixer :
you can download php-cs-fixer from http://get.sensiolabs.org/php-cs-fixer.phar |
/path/to/file.php >>> "file" would be the file which I want to fix? |
see travis https://travis-ci.org/zendframework/zf2/jobs/18593426 result. |
No need for this pull request, because this functionality already exists. The method In my <?php echo $this->render('layout/partial/messages'); ?> In <?php
$namespaces = array(
'default',
'error',
'info',
'success',
'warning',
);
$allMessages = array();
foreach ($namespaces as $namespace) {
$currentMessages = $this->flashMessenger()->getCurrentMessagesFromNamespace($namespace);
$this->flashMessenger()->clearCurrentMessagesFromNamespace($namespace);
$allMessages[$namespace] = array_merge($currentMessages, $this->flashMessenger($namespace));
}
var_dump($allMessages); |
Forgive me, but yes there is the need of the Implemented functionality. The method render of class FlashMessenger does not print the current messages. |
Instead of creating a complete new method with lots of duplicate code I think a much cleaner solution would be to attach a flag to the view helper and act upon that flag: $this->flashMessenger()->setUseCurrentMessages(true)->render(); |
That is, in one way or another, does not agree with my implementation. :P |
I agree with this: public function render($namespace = PluginFlashMessenger::NAMESPACE_DEFAULT, array $classes = array())
{
$flashMessenger = $this->getPluginFlashMessenger();
$messages = $flashMessenger->getMessagesFromNamespace($namespace);
return renderAssistant($messages, $classes);
}
public function renderCurrent($namespace = PluginFlashMessenger::NAMESPACE_DEFAULT, array $classes = array())
{
$flashMessenger = $this->getPluginFlashMessenger();
$messages = $flashMessenger->getCurrentMessagesFromNamespace($namespace);
return renderAssistant($messages, $classes);
}
protect function renderAssistant($messages, $classes)
{
...
} But disagree on creating an attribute that would have no utility unless this method, taking into account the whole structure that FlashMessenger own class. |
Please use markdown code to make your code readable: https://help.github.com/articles/github-flavored-markdown
Depends on what you want. I assumed you want to merge the messages, but I understand you want to be able to display the current messages separately? I would suggest a bit more descriptive method name for |
Look at my last commit, maintains the structure and become clean. ;) |
Nice! Much cleaner now 😃 Now it's a matter of waiting until this PR is accepted. |
This is a question of mine, who performs this work? |
You can look at the closed PR's for this: https://github.com/zendframework/zf2/pulls?direction=desc&page=1&sort=created&state=closed Some PR's are merged in 2 hours, but if I look at some of my PR's there has not been any response in 24 days, so I honostly got no idea how long it takes. I think they are somewhat behind of schedule looking at the fact there are still 160 PR's open. |
The who idea with FlashMessenger is to render something on the NEXT request. If you need to render the current message, doesn't that just mean you're using it wrong? |
The documented way of using it is indeed rendering messages on the next request. The FlashMessenger plugin however has a method What would be your suggestion to render messages on the current request? |
My changes in my opinion obeys the principles of FlashMessenger. No reinvention of the wheel. I await an opinion of the management as my changes. |
@diegobittencourt This PR conflicts with current master. Please rebase or merge master in the branch |
Is there any practice of documentation should I execute to perform this merge in my repository? |
@diegobittencourt you can do :
On this stage, maybe you will got conflict, so you need to fix conflict and git add the conflicted file :
and then git commit and then push --force to your branch
|
Good at my base I already have the last change, so I think it is all right :D |
when you did rebase and push --force, your commits must be showed under my last comment.... it seems you didn't do push --force ;) |
Look again my friend. It seems that now with your tips will produce more and less mess. |
Update FlashMessenger.php Conflicts: library/Zend/View/Helper/FlashMessenger.php
Merged to develop for release in 2.3.0. |
…ourt/patch-1 Update FlashMessenger.php Conflicts: library/Zend/View/Helper/FlashMessenger.php
Hello, the feature of rendering is fantastic, but you can not print the current message, this second method would make this work.