1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/manual/docs/Object relational mapping - Indexes - Index options.php

45 lines
1.4 KiB
PHP
Raw Normal View History

2007-01-25 15:34:03 +03:00
<?php ?>
Doctrine offers many index options, some of them being db-specific. Here is a full list of availible options:
<div class='sql'>
2007-02-11 14:13:37 +03:00
<pre>
2007-01-25 15:34:03 +03:00
sorting => string('ASC' / 'DESC')
what kind of sorting does the index use (ascending / descending)
2007-02-11 14:13:37 +03:00
length => integer
index length (only some drivers support this)
2007-01-25 15:34:03 +03:00
primary => boolean(true / false)
whether or not the index is primary index
2007-02-11 14:13:37 +03:00
type => string('unique', -- supported by most drivers
'fulltext', -- only availible on Mysql driver
'gist', -- only availible on Pgsql driver
'gin') -- only availible on Pgsql driver
2007-01-25 15:34:03 +03:00
</pre>
</div>
2007-02-11 14:13:37 +03:00
<?php
renderCode("<?php
class MultipleIndexTest extends Doctrine_Record
{
public function setTableDefinition()
{
\$this->hasColumn('name', 'string');
\$this->hasColumn('code', 'string');
\$this->hasColumn('age', 'integer');
}
public function setUp()
{
\$this->index('myindex', array(
'fields' => array(
'name' =>
array('sorting' => 'ASC',
'length' => 10),
'code'),
'type' => 'unique',
));
}
}
?>");
?>