diff --git a/lib/Doctrine.php b/lib/Doctrine.php index ade16f15b..0355a2c48 100644 --- a/lib/Doctrine.php +++ b/lib/Doctrine.php @@ -159,11 +159,9 @@ final class Doctrine const ATTR_DECIMAL_PLACES = 141; const ATTR_PORTABILITY = 106; - const ATTR_VLD = 107; + const ATTR_VALIDATE = 107; const ATTR_COLL_KEY = 108; const ATTR_QUERY_LIMIT = 109; - const ATTR_AUTO_LENGTH_VLD = 110; - const ATTR_AUTO_TYPE_VLD = 111; const ATTR_DEFAULT_TABLE_TYPE = 112; const ATTR_DEF_TEXT_LENGTH = 113; const ATTR_DEF_VARCHAR_LENGTH = 114; @@ -174,7 +172,9 @@ final class Doctrine /** TODO: REMOVE THE FOLLOWING CONSTANTS AND UPDATE THE DOCS ! */ - + const ATTR_VLD = -1; + const ATTR_AUTO_LENGTH_VLD = -2; + const ATTR_AUTO_TYPE_VLD = -3; const ATTR_FETCHMODE = 118; const ATTR_BATCH_SIZE = 119; const ATTR_LOCKMODE = 120; diff --git a/lib/Doctrine/Configurable.php b/lib/Doctrine/Configurable.php index 9c2f14001..b1e07efaa 100644 --- a/lib/Doctrine/Configurable.php +++ b/lib/Doctrine/Configurable.php @@ -118,6 +118,8 @@ abstract class Doctrine_Configurable extends Doctrine_Object case Doctrine::ATTR_VLD: case Doctrine::ATTR_AUTO_LENGTH_VLD: case Doctrine::ATTR_AUTO_TYPE_VLD: + throw new Doctrine_Exception('Deprecated attribute. See http://doctrine.pengus.net/doctrine/manual/new/?chapter=configuration#validation-attributes'); + case Doctrine::ATTR_VALIDATE: case Doctrine::ATTR_QUERY_LIMIT: case Doctrine::ATTR_QUOTE_IDENTIFIER: case Doctrine::ATTR_PORTABILITY: diff --git a/lib/Doctrine/Manager.php b/lib/Doctrine/Manager.php index 616d50439..79d13edaa 100644 --- a/lib/Doctrine/Manager.php +++ b/lib/Doctrine/Manager.php @@ -113,9 +113,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera Doctrine::ATTR_RECORD_LISTENER => new Doctrine_Record_Listener(), Doctrine::ATTR_THROW_EXCEPTIONS => true, Doctrine::ATTR_LOCKMODE => 1, - Doctrine::ATTR_VLD => false, - Doctrine::ATTR_AUTO_LENGTH_VLD => true, - Doctrine::ATTR_AUTO_TYPE_VLD => true, + Doctrine::ATTR_VALIDATE => Doctrine::VALIDATE_NONE, Doctrine::ATTR_QUERY_LIMIT => Doctrine::LIMIT_RECORDS, Doctrine::ATTR_IDXNAME_FORMAT => "%s_idx", Doctrine::ATTR_SEQNAME_FORMAT => "%s_seq", @@ -293,7 +291,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera $parts['dsn'] = 'sqlite::memory:'; } else { $parts['database'] = $parts['path']; - $parts['dsn'] = $parts['scheme'] . ':' . $parts['path']; + $parts['dsn'] = $parts['scheme'] . ':' . $parts['path']; } break; diff --git a/lib/Doctrine/Record.php b/lib/Doctrine/Record.php index ba6eeafbd..7c9f4932d 100644 --- a/lib/Doctrine/Record.php +++ b/lib/Doctrine/Record.php @@ -237,7 +237,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count */ public function isValid() { - if ( ! $this->_table->getAttribute(Doctrine::ATTR_VLD)) { + if ( ! $this->_table->getAttribute(Doctrine::ATTR_VALIDATE)) { return true; } // Clear the stack from any previous errors. diff --git a/lib/Doctrine/Validator.php b/lib/Doctrine/Validator.php index 325210a7d..ef71939e6 100644 --- a/lib/Doctrine/Validator.php +++ b/lib/Doctrine/Validator.php @@ -92,7 +92,7 @@ class Doctrine_Validator extends Doctrine_Object } } - if ($record->getTable()->getAttribute(Doctrine::ATTR_AUTO_LENGTH_VLD)) { + if ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_LENGTHS) { if (!$this->validateLength($column, $key, $value)) { $errorStack->add($key, 'length'); @@ -118,7 +118,7 @@ class Doctrine_Validator extends Doctrine_Object } if (strtolower($name) == 'length') { - if (!$record->getTable()->getAttribute(Doctrine::ATTR_AUTO_LENGTH_VLD)) { + if ( ! ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_LENGTHS)) { if (!$this->validateLength($column, $key, $value)) { $errorStack->add($key, 'length'); } @@ -127,7 +127,7 @@ class Doctrine_Validator extends Doctrine_Object } if (strtolower($name) == 'type') { - if (!$record->getTable()->getAttribute(Doctrine::ATTR_AUTO_TYPE_VLD)) { + if ( ! ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_TYPES)) { if ( ! self::isValidType($value, $column['type'])) { $errorStack->add($key, 'type'); } @@ -150,7 +150,7 @@ class Doctrine_Validator extends Doctrine_Object } } - if ($record->getTable()->getAttribute(Doctrine::ATTR_AUTO_TYPE_VLD)) { + if ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_TYPES) { if ( ! self::isValidType($value, $column['type'])) { $errorStack->add($key, 'type'); continue;