class FlashMessageContainer (View source)

internal  You should not interact with this object directly, use the FlashMessageService instead or the addFlashMessage() method when in an AbstractController implementation
 

This is a container for all Flash Messages.

Properties

protected array $messages

Methods

void
addMessage(Message $message)

Add a flash message object.

bool
hasMessages()

Whether there are any messages in the FlashMessageContainer

getMessages(string $severity = null)

Returns all currently stored flash messages.

void
flush(string $severity = null)

Remove messages from this container.

getMessagesAndFlush(string $severity = null)

Get all flash messages (with given severity) currently available and remove them from the container.

Details

void addMessage(Message $message)

Add a flash message object.

Parameters

Message $message

Return Value

void

bool hasMessages()

Whether there are any messages in the FlashMessageContainer

Return Value

bool

Message[] getMessages(string $severity = null)

Returns all currently stored flash messages.

Parameters

string $severity

severity of messages (from Message::SEVERITY_* constants) to return.

Return Value

Message[]

void flush(string $severity = null)

Remove messages from this container.

Parameters

string $severity

severity of messages (from Message::SEVERITY_* constants) to remove.

Return Value

void

Message[] getMessagesAndFlush(string $severity = null)

Get all flash messages (with given severity) currently available and remove them from the container.

Parameters

string $severity

severity of the messages (One of the Message::SEVERITY_* constants)

Return Value

Message[]