/** * Validate a xPDOObject by the parameters specified * * @access public * @param array $parameters An associative array of config parameters. * @return boolean Either true or false indicating valid or invalid. */ public function validate(array $parameters = array()) { $result = parent::validate($parameters); if (!empty($this->messages)) { reset($this->messages); while (list($k, $v) = each($this->messages)) { if (array_key_exists('message', $this->messages[$k])) { $this->messages[$k]['message'] = $this->object->xpdo->lexicon($this->messages[$k]['message']); } } } return $result; }
/** * Validate a xPDOObject by the parameters specified * * @access public * @param array $parameters An associative array of config parameters. * @return boolean Either true or false indicating valid or invalid. */ public function validate(array $parameters = array()) { $isNew = $this->object->isNew(); if ($isNew) { $validated = parent::validate($parameters); } else { $validated = (parent::validate($parameters) and $this->_validateObject()); } if (!empty($this->messages)) { reset($this->messages); while (list($k, $v) = each($this->messages)) { if (array_key_exists('message', $this->messages[$k])) { $this->messages[$k]['message'] = $this->xpdo->lexicon($this->messages[$k]['message']); } } } return $validated; }
/** * Validate the field values using an xPDOValidator. * * @param array $options An array of options to pass to the validator. * @return boolean True if validation was successful. */ public function validate(array $options = array()) { $validated = false; if ($validator = $this->getValidator()) { $validated = $this->_validator->validate($options); if ($this->xpdo->getDebug() === true) { $this->xpdo->log(xPDO::LOG_LEVEL_DEBUG, "Validator class executed, result = " . print_r($validated, true)); } } else { if ($this->xpdo->getDebug() === true) { $this->xpdo->log(xPDO::LOG_LEVEL_DEBUG, "No validator found for {$this->_class} instance."); } $validated = true; } return $validated; }