Class Phalcon\Validation\Message\Group

implements Countable, ArrayAccess, Iterator, Traversable

Source on GitHub

Represents a group of validation messages

Methods

public __construct ([array $messages])

Phalcon\Validation\Message\Group constructor

public Phalcon\Validation\Message offsetGet (int $index)

Gets an attribute a message using the array syntax

  1. <?php
  2. print_r(
  3. $messages[0]
  4. );

public offsetSet (int $index, Phalcon\Validation\Message $message)

Sets an attribute using the array-syntax

  1. <?php
  2. $messages[0] = new \Phalcon\Validation\Message("This is a message");

public boolean offsetExists (int $index)

Checks if an index exists

  1. <?php
  2. var_dump(
  3. isset($message["database"])
  4. );

public offsetUnset (mixed $index)

Removes a message from the list

  1. <?php
  2. unset($message["database"]);

public appendMessage (Phalcon\Validation\MessageInterface $message)

Appends a message to the group

  1. <?php
  2. $messages->appendMessage(
  3. new \Phalcon\Validation\Message("This is a message")
  4. );

public appendMessages (Phalcon\Validation\MessageInterface[] $messages)

Appends an array of messages to the group

  1. <?php
  2. $messages->appendMessages($messagesArray);

public array filter (string $fieldName)

Filters the message group by field name

public count ()

Returns the number of messages in the list

public rewind ()

Rewinds the internal iterator

public current ()

Returns the current message in the iterator

public key ()

Returns the current position/key in the iterator

public next ()

Moves the internal iteration pointer to the next position

public valid ()

Check if the current message in the iterator is valid

public static Phalcon\Validation\Message\Group __set_state (array $group)

Magic __set_state helps to re-build messages variable when exporting