fixes #721
This commit is contained in:
parent
d47f4ddab4
commit
767172a60d
@ -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
|
||||
*
|
||||
|
@ -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}}.
|
||||
|
||||
<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
|
||||
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user