<?php class myDenyStringValidator extends sfValidator { public function initialize($context, $parameters = null) { // initialize parent parent::initialize($context); // set defaults $this->setParameter('values_error', 'Invalid input'); $this->getParameterHolder()->add($parameters); return true; } public function execute(&$value, &$error) { $values = $this->getParameter('values'); if(!is_array($values)) return true; foreach($values as $check) { if($check==$value) { $error = $this->getParameter('values_error'); return false; } } return true; } } ?>