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
16d2ccfb
Commit
16d2ccfb
authored
Mar 06, 2014
by
Jan Sorgalla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add reverse engineering part for spatial indexes
parent
9f7c75f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
0 deletions
+53
-0
MySqlSchemaManager.php
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
+2
-0
MySqlSchemaManagerTest.php
...e/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
+27
-0
MySqlPointType.php
tests/Doctrine/Tests/Types/MySqlPointType.php
+24
-0
No files found.
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
View file @
16d2ccfb
...
...
@@ -73,6 +73,8 @@ class MySqlSchemaManager extends AbstractSchemaManager
}
if
(
strpos
(
$v
[
'index_type'
],
'FULLTEXT'
)
!==
false
)
{
$v
[
'flags'
]
=
array
(
'FULLTEXT'
);
}
elseif
(
strpos
(
$v
[
'index_type'
],
'SPATIAL'
)
!==
false
)
{
$v
[
'flags'
]
=
array
(
'SPATIAL'
);
}
$tableIndexes
[
$k
]
=
$v
;
}
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
View file @
16d2ccfb
...
...
@@ -5,11 +5,21 @@ namespace Doctrine\Tests\DBAL\Functional\Schema;
use
Doctrine\DBAL\Schema\Comparator
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\Schema
;
use
Doctrine\DBAL\Types\Type
;
require_once
__DIR__
.
'/../../../TestInit.php'
;
class
MySqlSchemaManagerTest
extends
SchemaManagerFunctionalTestCase
{
protected
function
setUp
()
{
parent
::
setUp
();
if
(
!
Type
::
hasType
(
'point'
))
{
Type
::
addType
(
'point'
,
'Doctrine\Tests\Types\MySqlPointType'
);
}
}
public
function
testSwitchPrimaryKeyColumns
()
{
$tableOld
=
new
Table
(
"switch_primary_key_columns"
);
...
...
@@ -66,6 +76,23 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this
->
assertTrue
(
$indexes
[
'f_index'
]
->
hasFlag
(
'fulltext'
));
}
public
function
testSpatialIndex
()
{
$table
=
new
Table
(
'spatial_index'
);
$table
->
addColumn
(
'point'
,
'point'
);
$table
->
addIndex
(
array
(
'point'
),
's_index'
);
$table
->
addOption
(
'engine'
,
'MyISAM'
);
$index
=
$table
->
getIndex
(
's_index'
);
$index
->
addFlag
(
'spatial'
);
$this
->
_sm
->
dropAndCreateTable
(
$table
);
$indexes
=
$this
->
_sm
->
listTableIndexes
(
'spatial_index'
);
$this
->
assertArrayHasKey
(
's_index'
,
$indexes
);
$this
->
assertTrue
(
$indexes
[
's_index'
]
->
hasFlag
(
'spatial'
));
}
/**
* @group DBAL-400
*/
...
...
tests/Doctrine/Tests/Types/MySqlPointType.php
0 → 100644
View file @
16d2ccfb
<?php
namespace
Doctrine\Tests\Types
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\Type
;
class
MySqlPointType
extends
Type
{
public
function
getName
()
{
return
'point'
;
}
public
function
getSQLDeclaration
(
array
$fieldDeclaration
,
AbstractPlatform
$platform
)
{
return
strtoupper
(
$this
->
getName
());
}
public
function
getMappedDatabaseTypes
(
AbstractPlatform
$platform
)
{
return
array
(
'point'
);
}
}
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