__construct()
getMessage()
getName()
setMessage()
validate()
_init()
_isNoUserValue()
$_condition
$_item
$_message
$_requirement
$_name
COND_VALUE_EQUALS
COND_VALUE_NOT_EQUALS
VALUE_ANY
VALUE_NONE
VALUE_XOR
Checks if dependencies between given items are matched
| category | Formagic |
|---|---|
| package | Rule |
| author | Florian Sonnenburg |
| copyright | Copyright (c) 2007-2011 Florian Sonnenburg |
| license | New BSD License |
| version | $Id: ItemDependency.php 169 2012-05-06 20:16:16Z meweasle $ |
__construct(array $arguments)
The default error message that is displayed if the rule is violated can be overwritten by $errorMessage.
| see | \self::_init() |
|---|---|
| inherited_from | \Formagic_Rule_Abstract::__construct() |
arrayThe rule options.
getMessage() : string
| inherited_from | \Formagic_Rule_Abstract::getMessage() |
|---|
stringMessage stringgetName() : string
| inherited_from | \Formagic_Rule_Abstract::getName() |
|---|
stringThe rule namesetMessage(mixed $message) : \Formagic_Rule_Abstract
Usually a rule will have one error message string that is used if the validation fails. If neccessary, Formagic_Rule_Abstract::_errorMessage can hold other variables, eg. an array of error messages for different outcomes of the validation process.
Implements a fluent interface pattern.
| see | \Formagic_Rule_Abstract::__construct() |
|---|---|
| inherited_from | \Formagic_Rule_Abstract::setMessage() |
mixedThe error message value.
\Formagic_Rule_Abstract$this object.validate(string $value) : boolean
Subclasses have to implement their behavior here.
stringValue to be checked
booleanTrue if conditions are matched_init(array $arguments) : void
Supported keys:
Scenario: Given item $item shall be valid if dependent item $dep has a value of 1.
$arguments = array(
['item'] => $dep,
['condition'] => Formagic_Rule_ItemDependency::COND_VALUE_EQUALS,
['requirement'] => 1,
);
arrayRule options.
\Formagic_Exception |
If key "item", "condition" or "requirement" is not provided or has invalid value |
|---|
_isNoUserValue(\$value $value) : boolean
The value 0 (zero) for example could be something the user entered willingly and would be skipped from rule checks when using empty().
| inherited_from | \Formagic_Rule_Abstract::_isNoUserValue() |
|---|
\$valuemixed Value to be checked
boolean$_condition : integer
$_requirement : mixed
$_name : string
| inherited_from | \Formagic_Rule_Abstract::$$_name |
|---|
COND_VALUE_EQUALS
COND_VALUE_NOT_EQUALS
VALUE_ANY
VALUE_NONE
VALUE_XOR
| todo | Implement Formagic_Rule_ItemDependency::VALUE_XOR |
|---|