From 6ed10e06ede70a5a7f56db3b03de1eaa306c2de2 Mon Sep 17 00:00:00 2001 From: adamthehutt Date: Thu, 21 Feb 2008 02:28:30 +0000 Subject: [PATCH] Added readonly validator --- lib/Doctrine/Validator/Readonly.php | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 lib/Doctrine/Validator/Readonly.php diff --git a/lib/Doctrine/Validator/Readonly.php b/lib/Doctrine/Validator/Readonly.php new file mode 100644 index 000000000..d4713777a --- /dev/null +++ b/lib/Doctrine/Validator/Readonly.php @@ -0,0 +1,43 @@ +. + */ + +/** + * Doctrine_Validator_Readonly + * + * @package Doctrine + * @subpackage Validator + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @link www.phpdoctrine.com + * @author Adam Huttler + */ +class Doctrine_Validator_Readonly +{ + /** + * checks if value has been modified + * + * @param mixed $value + * @return boolean + */ + public function validate($value) + { + $modified = $this->invoker->getModifed(); + + return array_key_exists($this->field, $modified) ? false : true; + } +} \ No newline at end of file