1
0
mirror of synced 2025-01-05 16:53:21 +03:00

deprecated validation attributes VLD, AUTO_LENGTH_VLD and AUTO_TYPE_VLD, introduced new attribute ATTR_VALIDATE

This commit is contained in:
zYne 2007-09-02 20:36:58 +00:00
parent 35bd97bf08
commit a6318cbe93
5 changed files with 13 additions and 13 deletions

View File

@ -159,11 +159,9 @@ final class Doctrine
const ATTR_DECIMAL_PLACES = 141; const ATTR_DECIMAL_PLACES = 141;
const ATTR_PORTABILITY = 106; const ATTR_PORTABILITY = 106;
const ATTR_VLD = 107; const ATTR_VALIDATE = 107;
const ATTR_COLL_KEY = 108; const ATTR_COLL_KEY = 108;
const ATTR_QUERY_LIMIT = 109; 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_DEFAULT_TABLE_TYPE = 112;
const ATTR_DEF_TEXT_LENGTH = 113; const ATTR_DEF_TEXT_LENGTH = 113;
const ATTR_DEF_VARCHAR_LENGTH = 114; const ATTR_DEF_VARCHAR_LENGTH = 114;
@ -174,7 +172,9 @@ final class Doctrine
/** TODO: REMOVE THE FOLLOWING CONSTANTS AND UPDATE THE DOCS ! */ /** 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_FETCHMODE = 118;
const ATTR_BATCH_SIZE = 119; const ATTR_BATCH_SIZE = 119;
const ATTR_LOCKMODE = 120; const ATTR_LOCKMODE = 120;

View File

@ -118,6 +118,8 @@ abstract class Doctrine_Configurable extends Doctrine_Object
case Doctrine::ATTR_VLD: case Doctrine::ATTR_VLD:
case Doctrine::ATTR_AUTO_LENGTH_VLD: case Doctrine::ATTR_AUTO_LENGTH_VLD:
case Doctrine::ATTR_AUTO_TYPE_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_QUERY_LIMIT:
case Doctrine::ATTR_QUOTE_IDENTIFIER: case Doctrine::ATTR_QUOTE_IDENTIFIER:
case Doctrine::ATTR_PORTABILITY: case Doctrine::ATTR_PORTABILITY:

View File

@ -113,9 +113,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
Doctrine::ATTR_RECORD_LISTENER => new Doctrine_Record_Listener(), Doctrine::ATTR_RECORD_LISTENER => new Doctrine_Record_Listener(),
Doctrine::ATTR_THROW_EXCEPTIONS => true, Doctrine::ATTR_THROW_EXCEPTIONS => true,
Doctrine::ATTR_LOCKMODE => 1, Doctrine::ATTR_LOCKMODE => 1,
Doctrine::ATTR_VLD => false, Doctrine::ATTR_VALIDATE => Doctrine::VALIDATE_NONE,
Doctrine::ATTR_AUTO_LENGTH_VLD => true,
Doctrine::ATTR_AUTO_TYPE_VLD => true,
Doctrine::ATTR_QUERY_LIMIT => Doctrine::LIMIT_RECORDS, Doctrine::ATTR_QUERY_LIMIT => Doctrine::LIMIT_RECORDS,
Doctrine::ATTR_IDXNAME_FORMAT => "%s_idx", Doctrine::ATTR_IDXNAME_FORMAT => "%s_idx",
Doctrine::ATTR_SEQNAME_FORMAT => "%s_seq", Doctrine::ATTR_SEQNAME_FORMAT => "%s_seq",
@ -293,7 +291,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
$parts['dsn'] = 'sqlite::memory:'; $parts['dsn'] = 'sqlite::memory:';
} else { } else {
$parts['database'] = $parts['path']; $parts['database'] = $parts['path'];
$parts['dsn'] = $parts['scheme'] . ':' . $parts['path']; $parts['dsn'] = $parts['scheme'] . ':' . $parts['path'];
} }
break; break;

View File

@ -237,7 +237,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*/ */
public function isValid() public function isValid()
{ {
if ( ! $this->_table->getAttribute(Doctrine::ATTR_VLD)) { if ( ! $this->_table->getAttribute(Doctrine::ATTR_VALIDATE)) {
return true; return true;
} }
// Clear the stack from any previous errors. // Clear the stack from any previous errors.

View File

@ -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)) { if (!$this->validateLength($column, $key, $value)) {
$errorStack->add($key, 'length'); $errorStack->add($key, 'length');
@ -118,7 +118,7 @@ class Doctrine_Validator extends Doctrine_Object
} }
if (strtolower($name) == 'length') { 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)) { if (!$this->validateLength($column, $key, $value)) {
$errorStack->add($key, 'length'); $errorStack->add($key, 'length');
} }
@ -127,7 +127,7 @@ class Doctrine_Validator extends Doctrine_Object
} }
if (strtolower($name) == 'type') { 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'])) { if ( ! self::isValidType($value, $column['type'])) {
$errorStack->add($key, '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'])) { if ( ! self::isValidType($value, $column['type'])) {
$errorStack->add($key, 'type'); $errorStack->add($key, 'type');
continue; continue;