class Callback in Plug 7
@Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"})
@author Bernhard Schussek <bschussek@gmail.com>
@api
Hierarchy
- class \Symfony\Component\Validator\Constraint
- class \Symfony\Component\Validator\Constraints\Callback
Expanded class hierarchy of Callback
8 files declare their use of Callback
- Abstract2Dot5ApiTest.php in lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Validator/ Abstract2Dot5ApiTest.php - AbstractLegacyApiTest.php in lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Validator/ AbstractLegacyApiTest.php - AbstractValidatorTest.php in lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Validator/ AbstractValidatorTest.php - AnnotationLoader.php in lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Mapping/ Loader/ AnnotationLoader.php - AnnotationLoaderTest.php in lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Mapping/ Loader/ AnnotationLoaderTest.php
File
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Constraints/ Callback.php, line 24
Namespace
Symfony\Component\Validator\ConstraintsView source
class Callback extends Constraint {
/**
* @var string|callable
*
* @since 2.4
*/
public $callback;
/**
* @var array
*
* @deprecated Deprecated since version 2.4, to be removed in Symfony 3.0.
*/
public $methods;
/**
* {@inheritdoc}
*/
public function __construct($options = null) {
// Invocation through annotations with an array parameter only
if (is_array($options) && 1 === count($options) && isset($options['value'])) {
$options = $options['value'];
}
if (is_array($options) && !isset($options['callback']) && !isset($options['methods']) && !isset($options['groups'])) {
if (is_callable($options)) {
$options = array(
'callback' => $options,
);
}
else {
// BC with Symfony < 2.4
$options = array(
'methods' => $options,
);
}
}
parent::__construct($options);
}
/**
* {@inheritdoc}
*/
public function getDefaultOption() {
return 'callback';
}
/**
* {@inheritdoc}
*/
public function getTargets() {
return array(
self::CLASS_CONSTRAINT,
self::PROPERTY_CONSTRAINT,
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Callback:: |
public | property | @since 2.4 | |
Callback:: |
public | property | ||
Callback:: |
public | function |
Returns the name of the default option. Overrides Constraint:: |
|
Callback:: |
public | function |
Returns whether the constraint can be put onto classes, properties or
both. Overrides Constraint:: |
|
Callback:: |
public | function |
Initializes the constraint with options. Overrides Constraint:: |
|
Constraint:: |
protected static | property | Maps error codes to the names of their constants | 16 |
Constraint:: |
public | property | Domain-specific data attached to a constraint | |
Constraint:: |
public | function | Adds the given group if this constraint is in the Default group. | 1 |
Constraint:: |
constant | Marks a constraint that can be put onto classes. | ||
Constraint:: |
constant | The name of the group given to all constraints with no explicit group. | ||
Constraint:: |
public static | function | Returns the name of the given error code. | |
Constraint:: |
public | function | Returns the name of the required options. | 7 |
Constraint:: |
constant | Marks a constraint that can be put onto properties. | ||
Constraint:: |
public | function | Returns the name of the class that validates this constraint. | 1 |
Constraint:: |
public | function | Returns the value of a lazily initialized option. | |
Constraint:: |
public | function | Sets the value of a lazily initialized option. | |
Constraint:: |
public | function | Optimizes the serialized value to minimize storage space. |