Open weierophinney opened 4 years ago
Any progress on that 'hops'-parameter? Or is it still useless?
@maatcode1 Any help with this problem is welcome!
I tried to fix this problem but I think with the current implementation this can not be fixed.
https://github.com/laminas/laminas-mvc-plugin-flashmessenger/blob/1.9.x/src/FlashMessenger.php#L659
This line always removes the namespace from the container, so there will be no namespace on any next hop.
Of course the expiration hops will always only work for the namespace, not for the given message, because this would need to have own expiration meta data for every single message.
Also I am a bit unsure why the expiration hops are only set if there are no messages added.
https://github.com/laminas/laminas-mvc-plugin-flashmessenger/blob/1.9.x/src/FlashMessenger.php#L167
In my opinion this should be set every time.
$container->setExpirationHops($hops, $namespace);
This would expire a namespace after the amount of hops which in our case means the x times the messages got read from the container.
I could try to improve this but may be we should remove the hops flag because it is not working and it would not work for a single message.
Last specified hop value is applied to all namespaces. Here, success message will be shown as many times as warnings. And if success is defined after warning, user will not be bugged with messages enough times. Need to apply hops to namespaces correctly.
Originally posted by @alextech at https://github.com/zendframework/zend-mvc-plugin-flashmessenger/issues/13