Commit a6318cbe authored by zYne's avatar zYne

deprecated validation attributes VLD, AUTO_LENGTH_VLD and AUTO_TYPE_VLD,...

deprecated validation attributes VLD, AUTO_LENGTH_VLD and AUTO_TYPE_VLD, introduced new attribute ATTR_VALIDATE
parent 35bd97bf
......@@ -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;
......
......@@ -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:
......
......@@ -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;
......
......@@ -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.
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment