From 767172a60d382686ea4a10117a80f9abe1878f96 Mon Sep 17 00:00:00 2001 From: jwage Date: Tue, 22 Jan 2008 23:10:21 +0000 Subject: [PATCH] fixes #721 --- lib/Doctrine/Record/Abstract.php | 10 +++++++++- .../constraints-and-validators.txt | 16 ---------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/lib/Doctrine/Record/Abstract.php b/lib/Doctrine/Record/Abstract.php index 7090c646c..a10b2fdd3 100644 --- a/lib/Doctrine/Record/Abstract.php +++ b/lib/Doctrine/Record/Abstract.php @@ -279,12 +279,20 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access { $this->_table->setColumn($name, $type, $length, $options); } + + /** + * hasColumns + * + * @param array $definitions + * @return void + */ public function hasColumns(array $definitions) { foreach ($definitions as $name => $options) { $this->hasColumn($name, $options['type'], $options['length'], $options); } - } + } + /** * loadTemplate * diff --git a/manual/docs/en/basic-schema-mapping/constraints-and-validators.txt b/manual/docs/en/basic-schema-mapping/constraints-and-validators.txt index 801e9d268..a6f1913fe 100644 --- a/manual/docs/en/basic-schema-mapping/constraints-and-validators.txt +++ b/manual/docs/en/basic-schema-mapping/constraints-and-validators.txt @@ -76,22 +76,6 @@ class User extends Doctrine_Record >> Note: You should only use unique constraints for other than primary key columns. Primary key columns are always unique. -The following definition adds a unique constraint for columns {{name}} and {{age}}. - - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 200); - $this->hasColumn('age', 'integer', 2); - - $this->unique(array('name', 'age')); - } -} - - - +++ Check Some of the Doctrine validators also act as database level check constraints. When a record with these validators is exported additional CHECK constraints are being added to CREATE TABLE statement.