Phalcon messages
NOTE
All classes are prefixed with Phalcon
Messages\Exception¶
Class Source on GitHub
Exceptions thrown in Phalcon\Messages* classes will use this class
\ExceptionPhalcon\Messages\Exception
Messages\Exceptions\MessageNotObject¶
Class Source on GitHub
\ExceptionPhalcon\Messages\ExceptionPhalcon\Messages\Exceptions\MessageNotObject
Uses Phalcon\Messages\Exception
Method Summary¶
Methods¶
__construct()¶
Messages\Exceptions\MessagesNotIterable¶
Class Source on GitHub
\ExceptionPhalcon\Messages\ExceptionPhalcon\Messages\Exceptions\MessagesNotIterable
Uses Phalcon\Messages\Exception
Method Summary¶
Methods¶
__construct()¶
Messages\Message¶
Class Source on GitHub
Phalcon\Messages\Message
Stores a message from various components
Phalcon\Messages\Message— implementsPhalcon\Messages\MessageInterface,JsonSerializable
Uses JsonSerializable
Method Summary¶
public __construct(string $message,string $field = "",string $type = "",int $code = 0,array $metaData = []) Phalcon\Messages\Message constructor public string __toString() Magic __toString method returns verbose message public int getCode() public string getField() public string getMessage() public array getMetaData() public string getType() public array jsonSerialize() Serializes the object for json_encode public MessageInterface setCode( int $code ) Sets code for the message public MessageInterface setField( string $field ) Sets field name related to message public MessageInterface setMessage( string $message ) Sets verbose message public MessageInterface setMetaData( array $metaData ) Sets message metadata public MessageInterface setType( string $type ) Sets message type Properties¶
protected int $code protected string $field protected string $message protected array $metaData = [] protected string $type Methods¶
__construct()¶
public function __construct(
string $message,
string $field = "",
string $type = "",
int $code = 0,
array $metaData = []
);
Phalcon\Messages\Message constructor
__toString()¶
Magic __toString method returns verbose message
getCode()¶
getField()¶
getMessage()¶
getMetaData()¶
getType()¶
jsonSerialize()¶
Serializes the object for json_encode
setCode()¶
Sets code for the message
setField()¶
Sets field name related to message
setMessage()¶
Sets verbose message
setMetaData()¶
Sets message metadata
setType()¶
Sets message type
Messages\MessageInterface¶
Interface Source on GitHub
Phalcon\Messages\MessageInterface
Interface for Phalcon\Messages\MessageInterface
Phalcon\Messages\MessageInterface
Method Summary¶
public string __toString() Magic __toString method returns verbose message public int getCode() Returns the message code related to this message public string getField() Returns field name related to message public string getMessage() Returns verbose message public array getMetaData() Returns message metadata public string getType() Returns message type public MessageInterface setCode( int $code ) Sets code for the message public MessageInterface setField( string $field ) Sets field name related to message public MessageInterface setMessage( string $message ) Sets verbose message public MessageInterface setMetaData( array $metaData ) Sets message metadata public MessageInterface setType( string $type ) Sets message type Methods¶
__toString()¶
Magic __toString method returns verbose message
getCode()¶
Returns the message code related to this message
getField()¶
Returns field name related to message
getMessage()¶
Returns verbose message
getMetaData()¶
Returns message metadata
getType()¶
Returns message type
setCode()¶
Sets code for the message
setField()¶
Sets field name related to message
setMessage()¶
Sets verbose message
setMetaData()¶
Sets message metadata
setType()¶
Sets message type
Messages\Messages¶
Class Source on GitHub
Represents a collection of messages
Messages are stored and iterated by integer position. An entry added under a string key through the ArrayAccess interface (for example $messages["database"] = $message) stays reachable by that offset but is not visited during iteration (foreach), which walks the integer sequence only. Use the append methods (appendMessage() / appendMessages()) when entries must take part in iteration.
Phalcon\Messages\Messages— implementsPhalcon\Contracts\Messages\Messages,JsonSerializable
Uses JsonSerializable · Phalcon\Contracts\Messages\Messages · Phalcon\Messages\Exceptions\MessageNotObject · Phalcon\Messages\Exceptions\MessagesNotIterable · Traversable
Method Summary¶
public __construct( array $messages = [] ) Phalcon\Messages\Messages constructor public void appendMessage( MessageInterface $message ) Appends a message to the collection public appendMessages( mixed $messages ) Appends an array of messages to the collection public int count() Returns the number of messages in the list public MessageInterface current() Returns the current message in the iterator public array filter( string $fieldName ) Filters the message collection by field name public array jsonSerialize() Returns serialised message objects as array for json_encode. Calls public int key() Returns the current position/key in the iterator public void next() Moves the internal iteration pointer to the next position public bool offsetExists( mixed $index ) Checks if an index exists public mixed offsetGet( mixed $index ) Gets an attribute a message using the array syntax public void offsetSet(mixed $offset,mixed $value) Sets an attribute using the array-syntax public void offsetUnset( mixed $index ) Removes a message from the list public void rewind() Rewinds the internal iterator public bool valid() Check if the current message in the iterator is valid Properties¶
protected array $messages protected int $position = 0 Methods¶
__construct()¶
Phalcon\Messages\Messages constructor
appendMessage()¶
Appends a message to the collection
appendMessages()¶
Appends an array of messages to the collection
count()¶
Returns the number of messages in the list
current()¶
Returns the current message in the iterator
filter()¶
Filters the message collection by field name
jsonSerialize()¶
Returns serialised message objects as array for json_encode. Calls jsonSerialize on each object if present
key()¶
Returns the current position/key in the iterator
next()¶
Moves the internal iteration pointer to the next position
offsetExists()¶
Checks if an index exists
offsetGet()¶
Gets an attribute a message using the array syntax
offsetSet()¶
Sets an attribute using the array-syntax
offsetUnset()¶
Removes a message from the list
rewind()¶
Rewinds the internal iterator
valid()¶
Check if the current message in the iterator is valid