Table Of Contents

Previous topic

< Class Phalcon\Translate\Exception

Next topic

Class Phalcon\Validation\Exception >

Class Phalcon\Validation

extends abstract class Phalcon\DI\Injectable

implements Phalcon\Events\EventsAwareInterface, Phalcon\DI\InjectionAwareInterface

Allows to validate data using validators

Methods

public __construct ([array $validators])

Phalcon\Validation constructor

public Phalcon\Validation\Message\Group validate ([array|object $data], [object $entity])

Validate a set of data according to a set of rules

public Phalcon\Validation add (string $attribute, unknown $validator)

Adds a validator to a field

public Phalcon\Validation setFilters (array|string $attribute, unknown $filters)

Adds filters to the field

public mixed getFilters ([string $attribute])

Returns all the filters or a specific one

public array getValidators ()

Returns the validators added to the validation

public object getEntity ()

Returns the bound entity

public Phalcon\Validation\Message\Group getMessages ()

Returns the registered validators

public Phalcon\Validation appendMessage (Phalcon\Validation\MessageInterface $message)

Appends a message to the messages list

public Phalcon\Validation bind (object $entity, object|array $data)

Assigns the data to an entity The entity is used to obtain the validation values

public mixed getValue (string $attribute)

Gets the a value to validate in the array/object data source

public setDefaultMessages ([unknown $messages])

...

public getDefaultMessage (unknown $type)

...

public setLabels (unknown $labels)

Adds labels for fields

public mixed getLabel (unknown $field)

Get label for field

public setDI (Phalcon\DiInterface $dependencyInjector) inherited from Phalcon\DI\Injectable

Sets the dependency injector

public Phalcon\DiInterface getDI () inherited from Phalcon\DI\Injectable

Returns the internal dependency injector

public setEventsManager (Phalcon\Events\ManagerInterface $eventsManager) inherited from Phalcon\DI\Injectable

Sets the event manager

public Phalcon\Events\ManagerInterface getEventsManager () inherited from Phalcon\DI\Injectable

Returns the internal event manager

public __get (unknown $property) inherited from Phalcon\DI\Injectable

Magic method __get