-
Notifications
You must be signed in to change notification settings - Fork 42
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
[4.x] Add "All Getters" for "Flash" values and "Add" #52
base: 4.x
Are you sure you want to change the base?
Conversation
public function getFlashAll($alt = array()) | ||
{ | ||
$this->resumeSession(); | ||
return isset($_SESSION[Session::FLASH_NOW][$this->name]) |
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.
Doesn't flash all means flash now + next ?
Fair point, @harikt. Perhaps the name is a little terse. |
3a638f7
to
743d5e2
Compare
Let's wait to hear from pmjones thoughts. |
743d5e2
to
cc0f489
Compare
- Segment::getFlashAll(); - Segment::getFlashNextAll();
cc0f489
to
5c7ca60
Compare
I added "add" methods here as well. @harikt, I just noticed that you said to wait on pmj, but i'm pretty sure you're right, so I had already gone and changed it. Obviously can always change to something else. As an illustration of my intended use case: <?php
// @codingStandardsIgnoreFile
abstract class MyAbstractResponder
{
protected $msgSegment = 'My\\Messages';
protected function addMessage($msg, $level = 'info')
{
$this->getSession()
->getSegment($this->msgSegment)
->addFlash(['lvl' => $level, 'msg' => $msg]);
}
protected function getMessages()
{
return $this->getSession()
->getSegment($this->msgSegment)
->getAllCurrentFlash([]);
}
protected function render()
{
$view = $this->getView();
$view->addData(['messages' => $this->getMessages()]);
$this->response->getBody()->write($view());
}
protected function updated()
{
$this->addMessage('Successfully updated thing', 'success');
$this->redirect();
}
//...
} |
@jakejohns Sorry that this is not merged. I am going to release a 4.x for session to make it compatible with 8.x . Newer feature is not incorported for now. So this is currently put on hold. |
This is just #47 for 3.x.
It looks like there was already a
getAll
equivalent:getSegment
.