Flash Messenger - implement session-based messages

category Zend
package Zend_Mvc
subpackage Controller\Plugin

 Methods

Add a message

addMessage(string $message) : \Zend\Mvc\Controller\Plugin\FlashMessenger

Parameters

$message

string

Returns

\Zend\Mvc\Controller\Plugin\FlashMessengerProvides a fluent interface

Clear messages from the current request and current namespace

clearCurrentMessages() : bool

Returns

bool

Clear all messages from the previous request & current namespace

clearMessages() : bool

Returns

boolTrue if messages were cleared, false if none existed

Complete the countable interface

count() : int

Returns

int

Get session container for flash messages

getContainer() : \Zend\Session\Container

Get the current controller instance

getController() : null | \Zend\Stdlib\DispatchableInterface
Inherited

inherited_from \Zend\Mvc\Controller\Plugin\AbstractPlugin::getController()

Returns

Get messages that have been added to the current namespace within this request

getCurrentMessages() : array

Returns

array

Complete the IteratorAggregate interface, for iterating

getIterator() : \ArrayIterator

Returns

Get messages from a specific namespace

getMessages() : array

Returns

array

Get the message namespace

getNamespace() : string

Returns

string

Retrieve the session manager

getSessionManager() : \Zend\Session\ManagerInterface

If none composed, lazy-loads a SessionManager instance

Returns

Check to see if messages have been added to the current namespace within this request

hasCurrentMessages() : bool

Returns

bool

Whether a specific namespace has messages

hasMessages() : bool

Returns

bool

Set the current controller instance

setController(\Zend\Stdlib\DispatchableInterface $controller) : void
Inherited

inherited_from \Zend\Mvc\Controller\Plugin\AbstractPlugin::setController()

Parameters

Change the namespace messages are added to

setNamespace(string $namespace) : \Zend\Mvc\Controller\Plugin\FlashMessenger

Useful for per action controller messaging between requests

Parameters

$namespace

string

Returns

\Zend\Mvc\Controller\Plugin\FlashMessengerProvides a fluent interface

Set the session manager

setSessionManager(\Zend\Session\ManagerInterface $manager) : \Zend\Mvc\Controller\Plugin\FlashMessenger

Pull messages from the session container

getMessagesFromContainer() : void

Iterates through the session container, removing messages into the local scope.

 Properties

 

$container

$container : \Zend\Session\Container

 

$controller

$controller : null | \Zend\Stdlib\DispatchableInterface
Inherited

inherited_from \Zend\Mvc\Controller\Plugin\AbstractPlugin::$$controller
 

Whether a message has been added during this request

$messageAdded : bool

 

Messages from previous request

$messages : array

 

Instance namespace, default is 'default'

$namespace : string

 

$session

$session : \Zend\Session\ManagerInterface