Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
07cbafe7
Commit
07cbafe7
authored
Jan 25, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More docs for the usage of indexes
parent
93977272
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
0 deletions
+112
-0
Getting started - Indexes - Adding indexes.php
manual/docs/Getting started - Indexes - Adding indexes.php
+70
-0
Getting started - Indexes - Index options.php
manual/docs/Getting started - Indexes - Index options.php
+20
-0
Getting started - Indexes - Special indexes.php
manual/docs/Getting started - Indexes - Special indexes.php
+22
-0
No files found.
manual/docs/Getting started - Indexes - Adding indexes.php
0 → 100644
View file @
07cbafe7
<?php
?>
You can add indexes by simple calling Doctrine_Record::option('index', $definition) where $definition is the
definition array. The structure of the definition array is as follows:
<div
class=
'sql'
>
<pre>
[ indexName1 => [col1 => [col1-options], ... , colN => [colN-options]
indexName2 => ...
indexNameN => ]
</pre>
</div>
<br
\
><br
\
>
An example of adding a simple index to field called 'name':
<br
\
><br
\
>
<?php
renderCode
(
"<?php
class IndexTest extends Doctrine_Record
{
public function setTableDefinition()
{
\$
this->hasColumn('name', 'string');
}
public function setUp()
{
\$
this->option('index', array('myindex' => 'name'));
}
}
?>"
);
?>
<br
\
><br
\
>
An example of adding a multi-column index to field called 'name':
<br
\
><br
\
>
<?php
renderCode
(
"<?php
class MultiColumnIndexTest extends Doctrine_Record
{
public function setTableDefinition()
{
\$
this->hasColumn('name', 'string');
\$
this->hasColumn('code', 'string');
}
public function setUp()
{
\$
this->option('index', array('myindex' => array('name', 'code')));
}
}
?>"
);
?>
<br
\
><br
\
>
An example of adding a multiple indexes on same table:
<br
\
><br
\
>
<?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->option('index',
array('myindex' => array('name', 'code')
'ageindex' => 'age')
);
}
}
?>"
);
?>
manual/docs/Getting started - Indexes - Index options.php
0 → 100644
View file @
07cbafe7
<?php
?>
Doctrine offers many index options, some of them being db-specific. Here is a full list of availible options:
<div
class=
'sql'
>
<pre>
unique => boolean(true / false)
whether or not the index is unique index
sorting => string('ASC' / 'DESC')
what kind of sorting does the index use (ascending / descending)
primary => boolean(true / false)
whether or not the index is primary index
fulltext => boolean(true / false)
whether or not the specified index is a FULLTEXT index (only availible on Mysql)
gist => boolean(true / false)
whether or not the specified index is a GiST index (only availible on Pgsql)
</pre>
</div>
manual/docs/Getting started - Indexes - Special indexes.php
0 → 100644
View file @
07cbafe7
<?php
?>
Doctrine supports many special indexes. These include Mysql FULLTEXT and Pgsql GiST indexes.
In the following example we define a Mysql FULLTEXT index for the field 'content'.
<br
\
><br
\
>
<?php
renderCode
(
"<?php
class Article
{
public function setTableDefinition()
{
\$
this->hasColumn('name', 'string');
\$
this->hasColumn('content', 'string');
}
public function setUp()
{
\$
this->option('index',
array('content' =>
array('content' =>
array('fulltext' => true));
}
}
?>"
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment