|
@@ 52-63 (lines=12) @@
|
| 49 |
|
* @param Assert $constraint |
| 50 |
|
* @param string $group |
| 51 |
|
*/ |
| 52 |
|
public function addPropertyConstraint($property, Assert $constraint, $group = null) |
| 53 |
|
{ |
| 54 |
|
$propertyMetadata = $this->getPropertyMetadata($property); |
| 55 |
|
if ($propertyMetadata === null) { |
| 56 |
|
$propertyMetadata = new PropertyMetadata($this->getClassName(), $property); |
| 57 |
|
$propertyMetadata->defaultGroup = $this->defaultGroup; |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
$propertyMetadata->addConstraint($constraint, $group); |
| 61 |
|
|
| 62 |
|
$this->addPropertyMetadata($propertyMetadata); |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
/** |
| 66 |
|
* @param string $property |
|
@@ 100-111 (lines=12) @@
|
| 97 |
|
* @param Assert $constraint |
| 98 |
|
* @param string $group |
| 99 |
|
*/ |
| 100 |
|
public function addMethodConstraint($method, Assert $constraint, $group = null) |
| 101 |
|
{ |
| 102 |
|
$methodMetadata = $this->getMethodMetadata($method); |
| 103 |
|
if ($methodMetadata === null) { |
| 104 |
|
$methodMetadata = new MethodMetadata($this->getClassName(), $method); |
| 105 |
|
$methodMetadata->defaultGroup = $this->defaultGroup; |
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
$methodMetadata->addConstraint($constraint, $group); |
| 109 |
|
|
| 110 |
|
$this->addMethodMetadata($methodMetadata); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
/** |
| 114 |
|
* @param string $method |