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
fb26e0a1
Commit
fb26e0a1
authored
Jan 25, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
constraint exporting added
parent
c88d183e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
3 deletions
+30
-3
Table.php
lib/Doctrine/Table.php
+30
-3
No files found.
lib/Doctrine/Table.php
View file @
fb26e0a1
...
...
@@ -143,6 +143,8 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
* -- charset character set
*
* -- collation
*
* -- index the index definitions of this table
*/
protected
$options
=
array
(
'name'
=>
null
,
'tableName'
=>
null
,
...
...
@@ -151,7 +153,8 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
'enumMap'
=>
array
(),
'engine'
=>
null
,
'charset'
=>
null
,
'collation'
=>
null
'collation'
=>
null
,
'index'
=>
array
(),
);
/**
...
...
@@ -307,7 +310,8 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
* @return boolean whether or not the export operation was successful
* false if table already existed in the database
*/
public
function
export
()
{
public
function
export
()
{
if
(
!
Doctrine
::
isValidClassname
(
$this
->
options
[
'declaringClass'
]
->
getName
()))
{
throw
new
Doctrine_Table_Exception
(
'Class name not valid.'
);
}
...
...
@@ -349,6 +353,28 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
}
}
}
/**
* exportConstraints
* exports the constraints of this table into database based on option definitions
*
* @throws Doctrine_Connection_Exception if something went wrong on db level
* @return void
*/
public
function
exportConstraints
()
{
try
{
$this
->
conn
->
beginTransaction
();
foreach
(
$this
->
options
[
'index'
]
as
$index
=>
$definition
)
{
$this
->
conn
->
export
->
createIndex
(
$this
->
options
[
'tableName'
],
$index
,
$definition
);
}
$this
->
conn
->
commit
();
}
catch
(
Doctrine_Connection_Exception
$e
)
{
$this
->
conn
->
rollback
();
throw
$e
;
}
}
/**
* createQuery
* creates a new Doctrine_Query object and adds the component name
...
...
@@ -378,8 +404,9 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
break
;
case
'enumMap'
:
case
'inheritanceMap'
:
case
'index'
:
if
(
!
is_array
(
$value
))
{
throw
new
Doctrine_Table_Exception
(
$name
.
' should be an array.'
);
throw
new
Doctrine_Table_Exception
(
$name
.
' should be an array.'
);
}
break
;
}
...
...
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