Skip to content

Commit

Permalink
Move 'default' validation set name to a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Burke committed Jan 29, 2015
1 parent 8e54bd3 commit 3739ca1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/ORM/Table.php
Expand Up @@ -120,6 +120,13 @@ class Table implements RepositoryInterface, EventListenerInterface

use EventManagerTrait;

/**
* Name of default validation set.
*
* @var string
*/
const VALIDATOR_DEFAULT = 'default';

/**
* Name of the table as it can be found in the database
*
Expand Down Expand Up @@ -248,7 +255,7 @@ public function __construct(array $config = [])
}
if (!empty($config['validator'])) {
if (!is_array($config['validator'])) {
$this->validator('default', $config['validator']);
$this->validator(self::VALIDATOR_DEFAULT, $config['validator']);
} else {
foreach ($config['validator'] as $name => $validator) {
$this->validator($name, $validator);
Expand Down Expand Up @@ -1142,7 +1149,7 @@ public function updateAll($fields, $conditions)
* use null to get a validator.
* @return \Cake\Validation\Validator
*/
public function validator($name = 'default', Validator $validator = null)
public function validator($name = self::VALIDATOR_DEFAULT, Validator $validator = null)
{
if ($validator === null && isset($this->_validators[$name])) {
return $this->_validators[$name];
Expand Down

0 comments on commit 3739ca1

Please sign in to comment.