|
|
@@ -163,7 +163,7 @@ trait ValidatorAwareTrait
|
|
|
protected function createValidator($name)
|
|
|
{
|
|
|
$method = 'validation' . ucfirst($name);
|
|
|
- if (!method_exists($this, $method)) {
|
|
|
+ if (!$this->validationMethodExists($method)) {
|
|
|
$message = sprintf('The %s::%s() validation method does not exists.', __CLASS__, $method);
|
|
|
throw new RuntimeException($message);
|
|
|
}
|
|
|
@@ -216,7 +216,7 @@ trait ValidatorAwareTrait
|
|
|
public function hasValidator($name)
|
|
|
{
|
|
|
$method = 'validation' . ucfirst($name);
|
|
|
- if (method_exists($this, $method)) {
|
|
|
+ if ($this->validationMethodExists($method)) {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -224,6 +224,17 @@ trait ValidatorAwareTrait
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Checks if validation method exists.
|
|
|
+ *
|
|
|
+ * @param string $name Validation method name.
|
|
|
+ * @return bool
|
|
|
+ */
|
|
|
+ protected function validationMethodExists($name)
|
|
|
+ {
|
|
|
+ return method_exists($this, $name);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Returns the default validator object. Subclasses can override this function
|
|
|
* to add a default validation set to the validator object.
|
|
|
*
|