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
6ce7d88c
Commit
6ce7d88c
authored
Aug 27, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ability to turn off foreign key sql exporting for specific models
parent
d82b58aa
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
21 deletions
+12
-21
Export.php
lib/Doctrine/Export.php
+5
-4
Mysql.php
lib/Doctrine/Export/Mysql.php
+2
-2
Pgsql.php
lib/Doctrine/Export/Pgsql.php
+2
-2
Sqlite.php
lib/Doctrine/Export/Sqlite.php
+1
-1
Abstract.php
lib/Doctrine/Record/Abstract.php
+2
-2
Table.php
lib/Doctrine/Table.php
+0
-10
No files found.
lib/Doctrine/Export.php
View file @
6ce7d88c
...
...
@@ -205,7 +205,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
*
* @return string
*/
public
function
createTableSql
(
$name
,
array
$fields
,
array
$options
=
array
())
public
function
createTableSql
(
$name
,
array
$fields
,
array
$options
=
array
()
,
$exportForeignKeySql
=
true
)
{
if
(
!
$name
)
{
throw
new
Doctrine_Export_Exception
(
'no valid table name specified'
);
...
...
@@ -242,7 +242,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
$sql
[]
=
$query
;
if
(
isset
(
$options
[
'foreignKeys'
]))
{
if
(
isset
(
$options
[
'foreignKeys'
])
&&
$exportForeignKeySql
)
{
foreach
((
array
)
$options
[
'foreignKeys'
]
as
$k
=>
$definition
)
{
if
(
is_array
(
$definition
))
{
...
...
@@ -1047,8 +1047,9 @@ class Doctrine_Export extends Doctrine_Connection_Module
$record
=
new
$name
();
$table
=
$record
->
getTable
();
$data
=
$table
->
getExportableFormat
();
$exportForeignKeySql
=
is_bool
(
$table
->
getOption
(
'export_foreign_key_sql'
))
?
$table
->
getOption
(
'export_foreign_key_sql'
)
:
true
;
$query
=
$this
->
conn
->
export
->
createTableSql
(
$data
[
'tableName'
],
$data
[
'columns'
],
$data
[
'options'
]);
$query
=
$this
->
conn
->
export
->
createTableSql
(
$data
[
'tableName'
],
$data
[
'columns'
],
$data
[
'options'
]
,
$exportForeignKeySql
);
if
(
is_array
(
$query
))
{
$sql
=
array_merge
(
$sql
,
$query
);
...
...
lib/Doctrine/Export/Mysql.php
View file @
6ce7d88c
...
...
@@ -87,7 +87,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
*
* @return void
*/
public
function
createTableSql
(
$name
,
array
$fields
,
array
$options
=
array
())
public
function
createTableSql
(
$name
,
array
$fields
,
array
$options
=
array
()
,
$exportForeignKeySql
=
true
)
{
if
(
!
$name
)
throw
new
Doctrine_Export_Exception
(
'no valid table name specified'
);
...
...
@@ -169,7 +169,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
}
$sql
[]
=
$query
;
if
(
isset
(
$options
[
'foreignKeys'
]))
{
if
(
isset
(
$options
[
'foreignKeys'
])
&&
$exportForeignKeySql
)
{
foreach
((
array
)
$options
[
'foreignKeys'
]
as
$k
=>
$definition
)
{
if
(
is_array
(
$definition
))
{
...
...
lib/Doctrine/Export/Pgsql.php
View file @
6ce7d88c
...
...
@@ -291,7 +291,7 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
* @param array $options
* @return unknown
*/
public
function
createTableSql
(
$name
,
array
$fields
,
array
$options
=
array
())
public
function
createTableSql
(
$name
,
array
$fields
,
array
$options
=
array
()
,
$exportForeignKeySql
=
true
)
{
if
(
!
$name
)
{
throw
new
Doctrine_Export_Exception
(
'no valid table name specified'
);
...
...
@@ -318,7 +318,7 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
}
}
if
(
isset
(
$options
[
'foreignKeys'
]))
{
if
(
isset
(
$options
[
'foreignKeys'
])
&&
$exportForeignKeySql
)
{
foreach
((
array
)
$options
[
'foreignKeys'
]
as
$k
=>
$definition
)
{
if
(
is_array
(
$definition
))
{
...
...
lib/Doctrine/Export/Sqlite.php
View file @
6ce7d88c
...
...
@@ -155,7 +155,7 @@ class Doctrine_Export_Sqlite extends Doctrine_Export
*
* @return void
*/
public
function
createTableSql
(
$name
,
array
$fields
,
array
$options
=
array
())
public
function
createTableSql
(
$name
,
array
$fields
,
array
$options
=
array
()
,
$exportForeignKeySql
=
true
)
{
if
(
!
$name
)
{
throw
new
Doctrine_Export_Exception
(
'no valid table name specified'
);
...
...
lib/Doctrine/Record/Abstract.php
View file @
6ce7d88c
...
...
@@ -148,7 +148,7 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
*/
public
function
option
(
$name
,
$value
=
null
)
{
if
(
$value
==
null
)
{
if
(
$value
==
=
null
)
{
if
(
is_array
(
$name
))
{
foreach
(
$name
as
$k
=>
$v
)
{
$this
->
_table
->
setOption
(
$k
,
$v
);
...
...
lib/Doctrine/Table.php
View file @
6ce7d88c
...
...
@@ -294,16 +294,6 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
}
$this
->
repository
=
new
Doctrine_Table_Repository
(
$this
);
}
/**
* getTemplates
* returns all templates attached to this table
*
* @return array an array containing all templates
*/
public
function
getTemplates
()
{
return
$this
->
_templates
;
}
/**
* export
* exports this table to database based on column and option definitions
...
...
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