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
69985832
Commit
69985832
authored
Nov 28, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
5738fed7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
69 deletions
+48
-69
AuditLog.php
lib/Doctrine/AuditLog.php
+2
-2
Export.php
lib/Doctrine/Export.php
+19
-19
I18n.php
lib/Doctrine/I18n.php
+1
-1
Abstract.php
lib/Doctrine/Record/Abstract.php
+3
-3
Generator.php
lib/Doctrine/Record/Generator.php
+6
-6
Search.php
lib/Doctrine/Search.php
+2
-2
Table.php
lib/Doctrine/Table.php
+15
-36
No files found.
lib/Doctrine/AuditLog.php
View file @
69985832
...
...
@@ -30,7 +30,7 @@
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class
Doctrine_AuditLog
extends
Doctrine_
Plugin
class
Doctrine_AuditLog
extends
Doctrine_
Record_Generator
{
protected
$_options
=
array
(
'className'
=>
'%CLASS%Version'
,
...
...
@@ -104,4 +104,4 @@ class Doctrine_AuditLog extends Doctrine_Plugin
// the version column should be part of the primary key definition
$this
->
hasColumn
(
$this
->
_options
[
'versionColumn'
],
'integer'
,
8
,
array
(
'primary'
=>
true
));
}
}
\ No newline at end of file
}
lib/Doctrine/Export.php
View file @
69985832
...
...
@@ -1153,7 +1153,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
}
if
(
$table
->
getAttribute
(
Doctrine
::
ATTR_EXPORT
)
&
Doctrine
::
EXPORT_PLUGINS
)
{
$sql
=
array_merge
(
$sql
,
$this
->
export
Plugin
sSql
(
$table
));
$sql
=
array_merge
(
$sql
,
$this
->
export
Generator
sSql
(
$table
));
}
}
...
...
@@ -1165,45 +1165,45 @@ class Doctrine_Export extends Doctrine_Connection_Module
}
/**
* fetches all
plugin
s recursively for given table
* fetches all
generator
s recursively for given table
*
* @param Doctrine_Table $table table object to retrieve the
plugin
s from
* @return array an array of Doctrine_
Plugin
objects
* @param Doctrine_Table $table table object to retrieve the
generator
s from
* @return array an array of Doctrine_
Record_Generator
objects
*/
public
function
getAll
Plugin
s
(
Doctrine_Table
$table
)
public
function
getAll
Generator
s
(
Doctrine_Table
$table
)
{
$
plugin
s
=
array
();
$
generator
s
=
array
();
foreach
(
$table
->
get
Plugins
()
as
$name
=>
$plugin
)
{
if
(
$
plugin
===
null
)
{
foreach
(
$table
->
get
Generators
()
as
$name
=>
$generator
)
{
if
(
$
generator
===
null
)
{
continue
;
}
$
plugins
[]
=
$plugin
;
$
generators
[]
=
$generator
;
$
pluginTable
=
$plugin
->
getTable
();
$
generatorTable
=
$generator
->
getTable
();
if
(
$
plugin
Table
instanceof
Doctrine_Table
)
{
$
plugins
=
array_merge
(
$plugins
,
$this
->
getAllPlugins
(
$plugin
Table
));
if
(
$
generator
Table
instanceof
Doctrine_Table
)
{
$
generators
=
array_merge
(
$generators
,
$this
->
getAllGenerators
(
$generator
Table
));
}
}
return
$
plugin
s
;
return
$
generator
s
;
}
/**
* export
Plugin
sSql
* export
Generator
sSql
* exports plugin tables for given table
*
* @param Doctrine_Table $table the table in which the
plugin
s belong to
* @return array an array of sql strings
* @param Doctrine_Table $table the table in which the
generator
s belong to
* @return array
an array of sql strings
*/
public
function
export
Plugin
sSql
(
Doctrine_Table
$table
)
public
function
export
Generator
sSql
(
Doctrine_Table
$table
)
{
$sql
=
array
();
foreach
(
$this
->
getAll
Plugins
(
$table
)
as
$name
=>
$plugin
)
{
$table
=
$
plugin
->
getTable
();
foreach
(
$this
->
getAll
Generators
(
$table
)
as
$name
=>
$generator
)
{
$table
=
$
generator
->
getTable
();
// Make sure plugin has a valid table
if
(
$table
instanceof
Doctrine_Table
)
{
...
...
lib/Doctrine/I18n.php
View file @
69985832
...
...
@@ -30,7 +30,7 @@
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class
Doctrine_I18n
extends
Doctrine_
Plugin
class
Doctrine_I18n
extends
Doctrine_
Record_Generator
{
protected
$_options
=
array
(
'className'
=>
'%CLASS%Translation'
,
...
...
lib/Doctrine/Record/Abstract.php
View file @
69985832
...
...
@@ -294,11 +294,11 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
return
$this
;
}
public
function
load
Plugin
(
Doctrine_Plugin
$plugin
)
public
function
load
Generator
(
Doctrine_Record_Generator
$generator
)
{
$
plugin
->
initialize
(
$this
->
_table
);
$
generator
->
initialize
(
$this
->
_table
);
$this
->
_table
->
add
Plugin
(
$plugin
,
get_class
(
$plugin
));
$this
->
_table
->
add
Generator
(
$generator
,
get_class
(
$generator
));
}
...
...
lib/Doctrine/
Plugin
.php
→
lib/Doctrine/
Record/Generator
.php
View file @
69985832
...
...
@@ -20,7 +20,7 @@
*/
/**
* Doctrine_
Plugin
* Doctrine_
Record_Generator
*
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @package Doctrine
...
...
@@ -30,7 +30,7 @@
* @link www.phpdoctrine.com
* @since 1.0
*/
abstract
class
Doctrine_
Plugin
extends
Doctrine_Record_Abstract
abstract
class
Doctrine_
Record_Generator
extends
Doctrine_Record_Abstract
{
/**
* @var array $_options an array of plugin specific options
...
...
@@ -96,7 +96,7 @@ abstract class Doctrine_Plugin extends Doctrine_Record_Abstract
return
$this
;
}
public
function
addChild
(
Doctrine_
Template
$template
)
public
function
addChild
(
Doctrine_
Record_Generator
$template
)
{
$this
->
_options
[
'children'
][]
=
$template
;
}
...
...
@@ -121,7 +121,7 @@ abstract class Doctrine_Plugin extends Doctrine_Record_Abstract
$this
->
initOptions
();
$table
->
add
Plugin
(
$this
,
get_class
(
$this
));
$table
->
add
Generator
(
$this
,
get_class
(
$this
));
$this
->
_options
[
'table'
]
=
$table
;
...
...
@@ -171,7 +171,7 @@ abstract class Doctrine_Plugin extends Doctrine_Record_Abstract
}
foreach
(
$this
->
_options
[
'children'
]
as
$child
)
{
$this
->
_table
->
add
Template
(
get_class
(
$child
),
$child
);
$this
->
_table
->
add
Generator
(
$child
,
get_class
(
$child
)
);
$child
->
setTable
(
$this
->
_table
);
...
...
@@ -274,7 +274,7 @@ abstract class Doctrine_Plugin extends Doctrine_Record_Abstract
$builder
->
buildRecord
(
$options
,
$columns
,
$relations
);
}
else
{
throw
new
Doctrine_
Plugin
_Exception
(
'If you wish to generate files then you must specify the path to generate the files in.'
);
throw
new
Doctrine_
Record
_Exception
(
'If you wish to generate files then you must specify the path to generate the files in.'
);
}
}
else
{
$def
=
$builder
->
buildDefinition
(
$options
,
$columns
,
$relations
);
...
...
lib/Doctrine/Search.php
View file @
69985832
...
...
@@ -30,7 +30,7 @@
* @link www.phpdoctrine.com
* @since 1.0
*/
class
Doctrine_Search
extends
Doctrine_
Plugin
class
Doctrine_Search
extends
Doctrine_
Record_Generator
{
const
INDEX_FILES
=
0
;
...
...
@@ -264,4 +264,4 @@ class Doctrine_Search extends Doctrine_Plugin
$this
->
hasColumns
(
$columns
);
}
}
\ No newline at end of file
}
lib/Doctrine/Table.php
View file @
69985832
...
...
@@ -186,14 +186,15 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
protected
$_templates
=
array
();
/**
* @see Doctrine_Record_Filter
* @var array $_filters an array containing all record filters attached to this table
*/
protected
$_filters
=
array
();
/**
* @see Doctrine_
Plugin
* @var array $_
plugins an array containing all plugin
s attached to this table
* @see Doctrine_
Record_Generator
* @var array $_
generators an array containing all generator
s attached to this table
*/
protected
$_
plugin
s
=
array
();
protected
$_
generator
s
=
array
();
/**
* @var array $_invokedMethods method invoker cache
...
...
@@ -609,28 +610,6 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
'options'
=>
array_merge
(
$this
->
getOptions
(),
$options
));
}
/**
* 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
;
}
}
/**
* getRelationParser
* return the relation parser associated with this table
...
...
@@ -1763,30 +1742,30 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
return
$this
;
}
public
function
get
Plugin
s
()
public
function
get
Generator
s
()
{
return
$this
->
_
plugin
s
;
return
$this
->
_
generator
s
;
}
public
function
get
Plugin
(
$plugin
)
public
function
get
Generator
(
$generator
)
{
if
(
!
isset
(
$this
->
_
plugins
[
$plugin
]))
{
throw
new
Doctrine_Table_Exception
(
'
Plugin '
.
$plugin
.
' not loaded'
);
if
(
!
isset
(
$this
->
_
generators
[
$generator
]))
{
throw
new
Doctrine_Table_Exception
(
'
Generator '
.
$generator
.
' not loaded'
);
}
return
$this
->
_
plugin
s
[
$plugin
];
return
$this
->
_
generator
s
[
$plugin
];
}
public
function
has
Plugin
(
$plugin
)
public
function
has
Generator
(
$generator
)
{
return
isset
(
$this
->
_
plugins
[
$plugin
]);
return
isset
(
$this
->
_
generators
[
$generator
]);
}
public
function
add
Plugin
(
Doctrine_Plugin
$plugin
,
$name
=
null
)
public
function
add
Generator
(
Doctrine_Record_Generator
$generator
,
$name
=
null
)
{
if
(
$name
===
null
)
{
$this
->
_
plugins
[]
=
$plugin
;
$this
->
_
generators
[]
=
$generator
;
}
else
{
$this
->
_
plugins
[
$name
]
=
$plugin
;
$this
->
_
generators
[
$name
]
=
$generator
;
}
return
$this
;
}
...
...
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