| 1 | <?php |
||
| 16 | class DecimalConstraintBuilder implements ConstraintBuilderInterface |
||
| 17 | { |
||
| 18 | |||
| 19 | /** |
||
| 20 | * the pattern to use |
||
| 21 | * |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | private $pattern = '^[+\-]?\d+(\.\d{0,4})?$'; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * if this builder supports a given constraint |
||
| 28 | * |
||
| 29 | * @param string $type Field type |
||
| 30 | * @param array $options Options |
||
| 31 | * |
||
| 32 | * @return bool |
||
| 33 | */ |
||
| 34 | public function supportsConstraint($type, array $options = []) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Adds constraints to the property |
||
| 41 | * |
||
| 42 | * @param string $fieldName field name |
||
| 43 | * @param Schema $property property |
||
| 44 | * @param DocumentModel $model parent model |
||
| 45 | * @param array $options the constraint options |
||
| 46 | * |
||
| 47 | * @return Schema the modified property |
||
| 48 | */ |
||
| 49 | public function buildConstraint($fieldName, Schema $property, DocumentModel $model, array $options) |
||
| 57 | } |
||
| 58 |