1
0
mirror of synced 2024-12-13 14:56:01 +03:00
This commit is contained in:
jwage 2008-01-22 23:10:21 +00:00
parent d47f4ddab4
commit 767172a60d
2 changed files with 9 additions and 17 deletions

View File

@ -279,12 +279,20 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
{ {
$this->_table->setColumn($name, $type, $length, $options); $this->_table->setColumn($name, $type, $length, $options);
} }
/**
* hasColumns
*
* @param array $definitions
* @return void
*/
public function hasColumns(array $definitions) public function hasColumns(array $definitions)
{ {
foreach ($definitions as $name => $options) { foreach ($definitions as $name => $options) {
$this->hasColumn($name, $options['type'], $options['length'], $options); $this->hasColumn($name, $options['type'], $options['length'], $options);
} }
} }
/** /**
* loadTemplate * loadTemplate
* *

View File

@ -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. >> 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}}.
<code type="php">
class User extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 200);
$this->hasColumn('age', 'integer', 2);
$this->unique(array('name', 'age'));
}
}
</code>
+++ Check +++ 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. 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.