Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1917d9c

Browse files
author
Pedro
committed
adding validator
1 parent 31f65d2 commit 1917d9c

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/**
4+
* mmValidatorReadOnly validates that the value has not been changed.
5+
*
6+
*
7+
*/
8+
class mmValidatorReadOnly extends sfValidatorBase
9+
{
10+
/**
11+
* Configures the current validator.
12+
*
13+
* Available options:
14+
*
15+
* * value: The value to be compared against (required)
16+
*
17+
* @see sfValidatorBase
18+
*/
19+
protected function configure($options = array(), $messages = array())
20+
{
21+
$this->addRequiredOption('value');
22+
$this->setOption('required', false);
23+
}
24+
25+
/**
26+
* @see sfValidatorBase
27+
*/
28+
protected function doClean($value)
29+
{
30+
//if($value != $this->getOption('value'))
31+
return $this->getOption('value');
32+
}
33+
}

0 commit comments

Comments
 (0)