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
a5f755f4
Commit
a5f755f4
authored
Nov 27, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enhanced plugin initialization procedure
parent
206002de
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
113 additions
and
118 deletions
+113
-118
AuditLog.php
lib/Doctrine/AuditLog.php
+4
-14
Listener.php
lib/Doctrine/AuditLog/Listener.php
+6
-2
Export.php
lib/Doctrine/Export.php
+3
-5
I18n.php
lib/Doctrine/I18n.php
+13
-25
Plugin.php
lib/Doctrine/Plugin.php
+70
-25
Search.php
lib/Doctrine/Search.php
+8
-25
File.php
lib/Doctrine/Search/File.php
+5
-1
I18n.php
lib/Doctrine/Template/I18n.php
+2
-10
Searchable.php
lib/Doctrine/Template/Searchable.php
+1
-10
Versionable.php
lib/Doctrine/Template/Versionable.php
+1
-1
No files found.
lib/Doctrine/AuditLog.php
View file @
a5f755f4
...
@@ -86,7 +86,7 @@ class Doctrine_AuditLog extends Doctrine_Plugin
...
@@ -86,7 +86,7 @@ class Doctrine_AuditLog extends Doctrine_Plugin
* @param Doctrine_Table $table
* @param Doctrine_Table $table
* @return boolean true on success otherwise false.
* @return boolean true on success otherwise false.
*/
*/
public
function
build
Definition
()
public
function
setTable
Definition
()
{
{
$name
=
$this
->
_options
[
'table'
]
->
getComponentName
();
$name
=
$this
->
_options
[
'table'
]
->
getComponentName
();
...
@@ -99,19 +99,9 @@ class Doctrine_AuditLog extends Doctrine_Plugin
...
@@ -99,19 +99,9 @@ class Doctrine_AuditLog extends Doctrine_Plugin
unset
(
$columns
[
$column
][
'unique'
]);
unset
(
$columns
[
$column
][
'unique'
]);
}
}
// the version column should be part of the primary key definition
$this
->
hasColumns
(
$columns
);
$columns
[
$this
->
_options
[
'versionColumn'
]]
=
array
(
'type'
=>
'integer'
,
'length'
=>
8
,
'primary'
=>
true
);
$id
=
$this
->
_options
[
'table'
]
->
getIdentifier
();
$relations
=
$this
->
buildRelation
();
$this
->
generateClass
(
$columns
,
$relations
);
// the version column should be part of the primary key definition
$this
->
hasColumn
(
$this
->
_options
[
'versionColumn'
],
'integer'
,
8
,
array
(
'primary'
=>
true
));
$this
->
_options
[
'pluginTable'
]
=
$this
->
_options
[
'table'
]
->
getConnection
()
->
getTable
(
$this
->
_options
[
'className'
]);
return
true
;
}
}
}
}
lib/Doctrine/AuditLog/Listener.php
View file @
a5f755f4
...
@@ -35,25 +35,28 @@ class Doctrine_AuditLog_Listener extends Doctrine_Record_Listener
...
@@ -35,25 +35,28 @@ class Doctrine_AuditLog_Listener extends Doctrine_Record_Listener
protected
$_auditLog
;
protected
$_auditLog
;
public
function
__construct
(
Doctrine_AuditLog
$auditLog
)
{
public
function
__construct
(
Doctrine_AuditLog
$auditLog
)
{
$this
->
_auditLog
=
$auditLog
;
$this
->
_auditLog
=
$auditLog
;
}
}
public
function
preInsert
(
Doctrine_Event
$event
)
public
function
preInsert
(
Doctrine_Event
$event
)
{
{
$versionColumn
=
$this
->
_auditLog
->
getOption
(
'versionColumn'
);
$versionColumn
=
$this
->
_auditLog
->
getOption
(
'versionColumn'
);
$event
->
getInvoker
()
->
set
(
$versionColumn
,
1
);
$event
->
getInvoker
()
->
set
(
$versionColumn
,
1
);
}
}
public
function
postInsert
(
Doctrine_Event
$event
)
public
function
postInsert
(
Doctrine_Event
$event
)
{
{
$class
=
$this
->
_auditLog
->
getOption
(
'className'
);
$class
=
$this
->
_auditLog
->
getOption
(
'className'
);
$record
=
$event
->
getInvoker
();
$record
=
$event
->
getInvoker
();
$version
=
new
$class
();
$version
=
new
$class
();
$version
->
merge
(
$record
->
toArray
());
$version
->
merge
(
$record
->
toArray
());
$version
->
save
();
$version
->
save
();
}
}
public
function
preDelete
(
Doctrine_Event
$event
)
public
function
preDelete
(
Doctrine_Event
$event
)
{
{
$class
=
$this
->
_auditLog
->
getOption
(
'className'
);
$class
=
$this
->
_auditLog
->
getOption
(
'className'
);
...
@@ -69,6 +72,7 @@ class Doctrine_AuditLog_Listener extends Doctrine_Record_Listener
...
@@ -69,6 +72,7 @@ class Doctrine_AuditLog_Listener extends Doctrine_Record_Listener
$version
->
merge
(
$record
->
toArray
());
$version
->
merge
(
$record
->
toArray
());
$version
->
save
();
$version
->
save
();
}
}
public
function
preUpdate
(
Doctrine_Event
$event
)
public
function
preUpdate
(
Doctrine_Event
$event
)
{
{
$class
=
$this
->
_auditLog
->
getOption
(
'className'
);
$class
=
$this
->
_auditLog
->
getOption
(
'className'
);
...
...
lib/Doctrine/Export.php
View file @
a5f755f4
...
@@ -1174,16 +1174,14 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1174,16 +1174,14 @@ class Doctrine_Export extends Doctrine_Connection_Module
{
{
$plugins
=
array
();
$plugins
=
array
();
foreach
(
$table
->
getTemplates
()
as
$name
=>
$template
)
{
foreach
(
$table
->
getPlugins
()
as
$name
=>
$plugin
)
{
$plugin
=
$template
->
getPlugin
();
if
(
$plugin
===
null
)
{
if
(
$plugin
===
null
)
{
continue
;
continue
;
}
}
$plugins
[]
=
$plugin
;
$plugins
[]
=
$plugin
;
$pluginTable
=
$plugin
->
get
Option
(
'pluginTable'
);
$pluginTable
=
$plugin
->
get
Table
(
);
if
(
$pluginTable
instanceof
Doctrine_Table
)
{
if
(
$pluginTable
instanceof
Doctrine_Table
)
{
$plugins
=
array_merge
(
$plugins
,
$this
->
getAllPlugins
(
$pluginTable
));
$plugins
=
array_merge
(
$plugins
,
$this
->
getAllPlugins
(
$pluginTable
));
...
@@ -1205,7 +1203,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1205,7 +1203,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
$sql
=
array
();
$sql
=
array
();
foreach
(
$this
->
getAllPlugins
(
$table
)
as
$name
=>
$plugin
)
{
foreach
(
$this
->
getAllPlugins
(
$table
)
as
$name
=>
$plugin
)
{
$table
=
$plugin
->
get
Option
(
'pluginTable'
);
$table
=
$plugin
->
get
Table
(
);
// Make sure plugin has a valid table
// Make sure plugin has a valid table
if
(
$table
instanceof
Doctrine_Table
)
{
if
(
$table
instanceof
Doctrine_Table
)
{
...
...
lib/Doctrine/I18n.php
View file @
a5f755f4
...
@@ -52,26 +52,26 @@ class Doctrine_I18n extends Doctrine_Plugin
...
@@ -52,26 +52,26 @@ class Doctrine_I18n extends Doctrine_Plugin
$this
->
_options
=
array_merge
(
$this
->
_options
,
$options
);
$this
->
_options
=
array_merge
(
$this
->
_options
,
$options
);
}
}
public
function
buildRelation
()
{
$this
->
buildForeignRelation
(
'Translation'
);
$this
->
buildLocalRelation
();
}
/**
/**
* buildDefinition
* buildDefinition
*
*
* @param object $Doctrine_Table
* @param object $Doctrine_Table
* @return void
* @return void
*/
*/
public
function
build
Definition
()
public
function
setTable
Definition
()
{
{
if
(
empty
(
$this
->
_options
[
'fields'
]))
{
if
(
empty
(
$this
->
_options
[
'fields'
]))
{
throw
new
Doctrine_I18n_Exception
(
'Fields not set.'
);
throw
new
Doctrine_I18n_Exception
(
'Fields not set.'
);
}
}
$name
=
$this
->
_options
[
'table'
]
->
getComponentName
();
$columns
=
array
();
$options
=
array
(
'className'
=>
$this
->
_options
[
'className'
]);
$options
=
array
(
'className'
=>
$this
->
_options
[
'className'
]);
$fk
=
$this
->
buildForeignKeys
(
$this
->
_options
[
'table'
]);
$cols
=
$this
->
_options
[
'table'
]
->
getColumns
();
$cols
=
$this
->
_options
[
'table'
]
->
getColumns
();
foreach
(
$cols
as
$column
=>
$definition
)
{
foreach
(
$cols
as
$column
=>
$definition
)
{
...
@@ -81,23 +81,11 @@ class Doctrine_I18n extends Doctrine_Plugin
...
@@ -81,23 +81,11 @@ class Doctrine_I18n extends Doctrine_Plugin
}
}
}
}
$columns
[
'lang'
]
=
array
(
'type'
=>
'string'
,
$this
->
hasColumns
(
$columns
);
'length'
=>
2
,
'fixed'
=>
true
,
'primary'
=>
true
);
$relations
=
$this
->
buildRelation
();
$columns
+=
$fk
;
$options
=
array
(
'queryParts'
=>
array
(
'indexBy'
=>
'lang'
));
$this
->
generateClass
(
$columns
,
$relations
,
$options
);
$this
->
_options
[
'pluginTable'
]
=
$this
->
_options
[
'table'
]
->
getConnection
()
->
getTable
(
$this
->
_options
[
'className'
]);
$this
->
_options
[
'pluginTable'
]
->
bindQueryPart
(
'indexBy'
,
'lang'
);
return
true
;
$this
->
hasColumn
(
'lang'
,
'string'
,
2
,
array
(
'fixed'
=>
true
,
'primary'
=>
true
));
$this
->
bindQueryParts
(
array
(
'indexBy'
=>
'lang'
));
}
}
}
}
lib/Doctrine/Plugin.php
View file @
a5f755f4
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
* @link www.phpdoctrine.com
* @link www.phpdoctrine.com
* @since 1.0
* @since 1.0
*/
*/
abstract
class
Doctrine_Plugin
abstract
class
Doctrine_Plugin
extends
Doctrine_Record_Abstract
{
{
/**
/**
* @var array $_options an array of plugin specific options
* @var array $_options an array of plugin specific options
...
@@ -41,7 +41,8 @@ abstract class Doctrine_Plugin
...
@@ -41,7 +41,8 @@ abstract class Doctrine_Plugin
'table'
=>
false
,
'table'
=>
false
,
'pluginTable'
=>
false
,
'pluginTable'
=>
false
,
'children'
=>
array
());
'children'
=>
array
());
protected
$_initialized
=
false
;
/**
/**
* __get
* __get
* an alias for getOption
* an alias for getOption
...
@@ -110,11 +111,19 @@ abstract class Doctrine_Plugin
...
@@ -110,11 +111,19 @@ abstract class Doctrine_Plugin
return
$this
->
_options
;
return
$this
->
_options
;
}
}
public
function
buildPluginDefinition
(
Doctrine_Table
$table
)
public
function
initialize
(
Doctrine_Table
$table
)
{
{
$this
->
initOptions
();
if
(
$this
->
_initialized
)
{
return
false
;
}
$this
->
_initialized
=
true
;
$this
->
initOptions
();
$this
->
_options
[
'table'
]
=
$table
;
$table
->
addPlugin
(
$this
,
get_class
(
$this
));
$this
->
_options
[
'table'
]
=
$table
;
$this
->
_options
[
'className'
]
=
str_replace
(
'%CLASS%'
,
$this
->
_options
[
'className'
]
=
str_replace
(
'%CLASS%'
,
$this
->
_options
[
'table'
]
->
getComponentName
(),
$this
->
_options
[
'table'
]
->
getComponentName
(),
...
@@ -125,35 +134,47 @@ abstract class Doctrine_Plugin
...
@@ -125,35 +134,47 @@ abstract class Doctrine_Plugin
return
false
;
return
false
;
}
}
$this
->
buildDefinition
();
$conn
=
$this
->
_options
[
'table'
]
->
getConnection
();
$this
->
_table
=
new
Doctrine_Table
(
$this
->
_options
[
'className'
],
$conn
);
$conn
->
addTable
(
$this
->
_table
);
$fk
=
$this
->
buildForeignKeys
(
$this
->
_options
[
'table'
]);
$this
->
_table
->
setColumns
(
$fk
);
$this
->
buildRelation
();
$this
->
setTableDefinition
();
$this
->
setUp
();
$this
->
generateClass
(
$this
->
_table
->
getColumns
());
$this
->
buildChildDefinitions
();
$this
->
buildChildDefinitions
();
}
}
/**
/**
* empty template method for providing the concrete plugins the ability
* empty template method for providing the concrete plugins the ability
* to initialize options before the actual definition is being built
* to initialize options before the actual definition is being built
*
*
* @return void
* @return void
*/
*/
public
function
initOptions
()
public
function
initOptions
()
{
{
}
}
abstract
public
function
buildDefinition
();
public
function
buildChildDefinitions
()
public
function
buildChildDefinitions
()
{
{
if
(
!
isset
(
$this
->
_options
[
'children'
]))
{
if
(
!
isset
(
$this
->
_options
[
'children'
]))
{
Doctrine
::
dump
(
debug_backtrace
());
throw
new
Doctrine_Plugin_Exception
(
"Unknown option 'children'."
);
throw
new
Doctrine_Plugin_Exception
(
"Unknown option 'children'."
);
}
}
foreach
(
$this
->
_options
[
'children'
]
as
$child
)
{
foreach
(
$this
->
_options
[
'children'
]
as
$child
)
{
$this
->
_options
[
'pluginTable'
]
->
addTemplate
(
get_class
(
$child
),
$child
);
$this
->
_table
->
addTemplate
(
get_class
(
$child
),
$child
);
$child
->
setTable
(
$this
->
_table
);
$child
->
setTable
(
$this
->
_options
[
'pluginTable'
]);
$child
->
setUp
();
$child
->
setUp
();
}
}
}
}
...
@@ -186,6 +207,35 @@ abstract class Doctrine_Plugin
...
@@ -186,6 +207,35 @@ abstract class Doctrine_Plugin
return
$fk
;
return
$fk
;
}
}
public
function
buildLocalRelation
()
{
$options
=
array
(
'local'
=>
$this
->
_options
[
'table'
]
->
getIdentifier
(),
'foreign'
=>
$this
->
_options
[
'table'
]
->
getIdentifier
(),
'type'
=>
Doctrine_Relation
::
MANY
);
$options
[
'type'
]
=
Doctrine_Relation
::
ONE
;
$options
[
'onDelete'
]
=
'CASCADE'
;
$options
[
'onUpdate'
]
=
'CASCADE'
;
$this
->
_table
->
getRelationParser
()
->
bind
(
$this
->
_options
[
'table'
]
->
getComponentName
(),
$options
);
}
public
function
buildForeignRelation
(
$alias
=
null
)
{
$options
=
array
(
'local'
=>
$this
->
_options
[
'table'
]
->
getIdentifier
(),
'foreign'
=>
$this
->
_options
[
'table'
]
->
getIdentifier
(),
'type'
=>
Doctrine_Relation
::
MANY
);
$aliasStr
=
''
;
if
(
$alias
!==
null
)
{
$aliasStr
=
' as '
.
$alias
;
}
$this
->
_options
[
'table'
]
->
getRelationParser
()
->
bind
(
$this
->
_table
->
getComponentName
()
.
$aliasStr
,
$options
);
}
/**
/**
* build a relation array to given table
* build a relation array to given table
*
*
...
@@ -196,13 +246,8 @@ abstract class Doctrine_Plugin
...
@@ -196,13 +246,8 @@ abstract class Doctrine_Plugin
*/
*/
public
function
buildRelation
()
public
function
buildRelation
()
{
{
$relation
=
array
(
$this
->
_options
[
'table'
]
->
getComponentName
()
=>
$this
->
buildForeignRelation
();
array
(
'local'
=>
$this
->
_options
[
'table'
]
->
getIdentifier
(),
$this
->
buildLocalRelation
();
'foreign'
=>
$this
->
_options
[
'table'
]
->
getIdentifier
(),
'onDelete'
=>
'CASCADE'
,
'onUpdate'
=>
'CASCADE'
));
return
$relation
;
}
}
/**
/**
...
@@ -219,7 +264,7 @@ abstract class Doctrine_Plugin
...
@@ -219,7 +264,7 @@ abstract class Doctrine_Plugin
*/
*/
public
function
generateClass
(
array
$columns
=
array
(),
array
$relations
=
array
(),
array
$options
=
array
())
public
function
generateClass
(
array
$columns
=
array
(),
array
$relations
=
array
(),
array
$options
=
array
())
{
{
$options
[
'className'
]
=
$this
->
_options
[
'className'
];
$options
[
'className'
]
=
$this
->
_options
[
'className'
];
$builder
=
new
Doctrine_Import_Builder
();
$builder
=
new
Doctrine_Import_Builder
();
...
...
lib/Doctrine/Search.php
View file @
a5f755f4
...
@@ -73,7 +73,7 @@ class Doctrine_Search extends Doctrine_Plugin
...
@@ -73,7 +73,7 @@ class Doctrine_Search extends Doctrine_Plugin
*/
*/
public
function
search
(
$query
)
public
function
search
(
$query
)
{
{
$q
=
new
Doctrine_Search_Query
(
$this
->
_
options
[
'pluginTable'
]
);
$q
=
new
Doctrine_Search_Query
(
$this
->
_
table
);
$q
->
query
(
$query
);
$q
->
query
(
$query
);
...
@@ -100,7 +100,7 @@ class Doctrine_Search extends Doctrine_Plugin
...
@@ -100,7 +100,7 @@ class Doctrine_Search extends Doctrine_Plugin
*/
*/
public
function
updateIndex
(
array
$data
)
public
function
updateIndex
(
array
$data
)
{
{
$this
->
buildDefinition
();
$this
->
initialize
(
$this
->
_options
[
'table'
]);
$fields
=
$this
->
getOption
(
'fields'
);
$fields
=
$this
->
getOption
(
'fields'
);
$class
=
$this
->
getOption
(
'className'
);
$class
=
$this
->
getOption
(
'className'
);
...
@@ -155,7 +155,7 @@ class Doctrine_Search extends Doctrine_Plugin
...
@@ -155,7 +155,7 @@ class Doctrine_Search extends Doctrine_Plugin
*/
*/
public
function
readTableData
(
$limit
=
null
,
$offset
=
null
)
public
function
readTableData
(
$limit
=
null
,
$offset
=
null
)
{
{
$this
->
buildDefinition
();
$this
->
initialize
(
$this
->
_options
[
'table'
]);
$conn
=
$this
->
_options
[
'table'
]
->
getConnection
();
$conn
=
$this
->
_options
[
'table'
]
->
getConnection
();
$tableName
=
$this
->
_options
[
'table'
]
->
getTableName
();
$tableName
=
$this
->
_options
[
'table'
]
->
getTableName
();
...
@@ -164,7 +164,7 @@ class Doctrine_Search extends Doctrine_Plugin
...
@@ -164,7 +164,7 @@ class Doctrine_Search extends Doctrine_Plugin
$query
=
'SELECT * FROM '
.
$conn
->
quoteIdentifier
(
$tableName
)
$query
=
'SELECT * FROM '
.
$conn
->
quoteIdentifier
(
$tableName
)
.
' WHERE '
.
$conn
->
quoteIdentifier
(
$id
)
.
' WHERE '
.
$conn
->
quoteIdentifier
(
$id
)
.
' IN (SELECT '
.
$conn
->
quoteIdentifier
(
$id
)
.
' IN (SELECT '
.
$conn
->
quoteIdentifier
(
$id
)
.
' FROM '
.
$conn
->
quoteIdentifier
(
$this
->
_
options
[
'pluginTable'
]
->
getTableName
())
.
' FROM '
.
$conn
->
quoteIdentifier
(
$this
->
_
table
->
getTableName
())
.
' WHERE keyword IS NULL)'
;
.
' WHERE keyword IS NULL)'
;
$query
=
$conn
->
modifyLimitQuery
(
$query
,
$limit
,
$offset
);
$query
=
$conn
->
modifyLimitQuery
(
$query
,
$limit
,
$offset
);
...
@@ -183,7 +183,7 @@ class Doctrine_Search extends Doctrine_Plugin
...
@@ -183,7 +183,7 @@ class Doctrine_Search extends Doctrine_Plugin
*/
*/
public
function
batchUpdateIndex
(
$limit
=
null
,
$offset
=
null
)
public
function
batchUpdateIndex
(
$limit
=
null
,
$offset
=
null
)
{
{
$this
->
buildDefinition
(
);
$this
->
initialize
(
$this
->
_options
[
'table'
]
);
$id
=
$this
->
_options
[
'table'
]
->
getIdentifier
();
$id
=
$this
->
_options
[
'table'
]
->
getIdentifier
();
$class
=
$this
->
_options
[
'className'
];
$class
=
$this
->
_options
[
'className'
];
...
@@ -200,7 +200,7 @@ class Doctrine_Search extends Doctrine_Plugin
...
@@ -200,7 +200,7 @@ class Doctrine_Search extends Doctrine_Plugin
}
}
$conn
->
exec
(
'DELETE FROM '
$conn
->
exec
(
'DELETE FROM '
.
$conn
->
quoteIdentifier
(
$this
->
_
options
[
'pluginTable'
]
->
getTableName
())
.
$conn
->
quoteIdentifier
(
$this
->
_
table
->
getTableName
())
.
' WHERE '
.
$conn
->
quoteIdentifier
(
$id
)
.
' IN ('
.
implode
(
', '
,
$ids
)
.
')'
);
.
' WHERE '
.
$conn
->
quoteIdentifier
(
$id
)
.
' IN ('
.
implode
(
', '
,
$ids
)
.
')'
);
foreach
(
$rows
as
$row
)
{
foreach
(
$rows
as
$row
)
{
...
@@ -236,10 +236,9 @@ class Doctrine_Search extends Doctrine_Plugin
...
@@ -236,10 +236,9 @@ class Doctrine_Search extends Doctrine_Plugin
*
*
* @return void
* @return void
*/
*/
public
function
build
Definition
()
public
function
setTable
Definition
()
{
{
if
(
!
isset
(
$this
->
_options
[
'table'
]))
{
if
(
!
isset
(
$this
->
_options
[
'table'
]))
{
Doctrine
::
dump
(
debug_backtrace
());
throw
new
Doctrine_Plugin_Exception
(
"Unknown option 'table'."
);
throw
new
Doctrine_Plugin_Exception
(
"Unknown option 'table'."
);
}
}
...
@@ -263,22 +262,6 @@ class Doctrine_Search extends Doctrine_Plugin
...
@@ -263,22 +262,6 @@ class Doctrine_Search extends Doctrine_Plugin
'primary'
=>
true
,
'primary'
=>
true
,
));
));
$id
=
$this
->
_options
[
'table'
]
->
getIdentifier
();
$this
->
hasColumns
(
$columns
);
$fk
=
$this
->
buildForeignKeys
(
$this
->
_options
[
'table'
]);
$columns
+=
$fk
;
$relations
=
array
();
// only generate relations for database based searches
if
(
!
$this
instanceof
Doctrine_Search_File
)
{
$relations
=
$this
->
buildRelation
();
}
$this
->
generateClass
(
$columns
,
$relations
);
$this
->
_options
[
'pluginTable'
]
=
$this
->
_options
[
'connection'
]
->
getTable
(
$this
->
_options
[
'className'
]);
return
true
;
}
}
}
}
lib/Doctrine/Search/File.php
View file @
a5f755f4
...
@@ -51,8 +51,12 @@ class Doctrine_Search_File extends Doctrine_Search
...
@@ -51,8 +51,12 @@ class Doctrine_Search_File extends Doctrine_Search
$this
->
_options
[
'fields'
]
=
array
(
'url'
,
'content'
);
$this
->
_options
[
'fields'
]
=
array
(
'url'
,
'content'
);
}
}
$this
->
buildPluginDefinition
(
$table
);
$this
->
initialize
(
$table
);
}
}
public
function
buildRelation
()
{
}
/**
/**
* indexes given directory
* indexes given directory
*
*
...
...
lib/Doctrine/Template/I18n.php
View file @
a5f755f4
...
@@ -49,17 +49,9 @@ class Doctrine_Template_I18n extends Doctrine_Template
...
@@ -49,17 +49,9 @@ class Doctrine_Template_I18n extends Doctrine_Template
*/
*/
public
function
setUp
()
public
function
setUp
()
{
{
$name
=
$this
->
_table
->
getComponentName
();
$this
->
_plugin
->
initialize
(
$this
->
_table
);
$this
->
_plugin
->
buildPluginDefinition
(
$this
->
_table
);
$className
=
$this
->
_plugin
->
getOption
(
'className'
);
$id
=
$this
->
_table
->
getIdentifier
();
$this
->
hasMany
(
$className
.
' as Translation'
,
array
(
'local'
=>
$id
,
'foreign'
=>
$id
));
}
}
/**
/**
* getI18n
* getI18n
*
*
...
...
lib/Doctrine/Template/Searchable.php
View file @
a5f755f4
...
@@ -37,18 +37,9 @@ class Doctrine_Template_Searchable extends Doctrine_Template
...
@@ -37,18 +37,9 @@ class Doctrine_Template_Searchable extends Doctrine_Template
$this
->
_plugin
=
new
Doctrine_Search
(
$options
);
$this
->
_plugin
=
new
Doctrine_Search
(
$options
);
}
}
public
function
getPlugin
()
{
return
$this
->
_plugin
;
}
public
function
setUp
()
public
function
setUp
()
{
{
$id
=
$this
->
_table
->
getIdentifier
();
$this
->
_plugin
->
initialize
(
$this
->
_table
);
$this
->
_plugin
->
buildPluginDefinition
(
$this
->
_table
);
$this
->
hasMany
(
$this
->
_plugin
->
getOption
(
'className'
),
array
(
'local'
=>
$id
,
'foreign'
=>
$id
));
$this
->
addListener
(
new
Doctrine_Search_Listener
(
$this
->
_plugin
));
$this
->
addListener
(
new
Doctrine_Search_Listener
(
$this
->
_plugin
));
}
}
...
...
lib/Doctrine/Template/Versionable.php
View file @
a5f755f4
...
@@ -38,7 +38,7 @@ class Doctrine_Template_Versionable extends Doctrine_Template
...
@@ -38,7 +38,7 @@ class Doctrine_Template_Versionable extends Doctrine_Template
}
}
public
function
setUp
()
public
function
setUp
()
{
{
$this
->
_plugin
->
buildPluginDefinition
(
$this
->
_table
);
$this
->
_plugin
->
initialize
(
$this
->
_table
);
$this
->
hasColumn
(
'version'
,
'integer'
,
8
);
$this
->
hasColumn
(
'version'
,
'integer'
,
8
);
...
...
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