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
657d6566
Commit
657d6566
authored
Oct 13, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored plugins
parent
780c0deb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
45 deletions
+29
-45
AuditLog.php
lib/Doctrine/AuditLog.php
+4
-6
I18n.php
lib/Doctrine/I18n.php
+1
-6
Plugin.php
lib/Doctrine/Plugin.php
+21
-2
Search.php
lib/Doctrine/Search.php
+3
-31
No files found.
lib/Doctrine/AuditLog.php
View file @
657d6566
...
...
@@ -36,6 +36,7 @@ class Doctrine_AuditLog extends Doctrine_Plugin
'versionColumn'
=>
'version'
,
'generateFiles'
=>
false
,
'table'
=>
false
,
'pluginTable'
=>
false
,
);
protected
$_auditTable
;
...
...
@@ -96,13 +97,10 @@ class Doctrine_AuditLog extends Doctrine_Plugin
$options
=
array
(
'className'
=>
$className
);
$
builder
=
new
Doctrine_Import_Builder
(
);
$
def
=
$builder
->
buildDefinition
(
$options
,
$columns
);
$
this
->
generateDefinition
(
$options
,
$columns
,
array
()
);
$
this
->
_options
[
'pluginTable'
]
=
$table
->
getConnection
()
->
getTable
(
$this
->
_options
[
'className'
]
);
if
(
!
$this
->
_options
[
'generateFiles'
])
{
eval
(
$def
);
}
return
true
;
}
}
lib/Doctrine/I18n.php
View file @
657d6566
...
...
@@ -106,13 +106,8 @@ class Doctrine_I18n extends Doctrine_Plugin
$options
=
array
(
'className'
=>
$this
->
_options
[
'className'
],
'queryParts'
=>
array
(
'indexBy'
=>
'lang'
));
$
builder
=
new
Doctrine_Import_Builder
(
);
$
this
->
generateClass
(
$options
,
$columns
,
$relations
);
$def
=
$builder
->
buildDefinition
(
$options
,
$columns
,
$relations
);
if
(
!
$this
->
_options
[
'generateFiles'
])
{
eval
(
$def
);
}
$this
->
_options
[
'pluginTable'
]
=
$table
->
getConnection
()
->
getTable
(
$this
->
_options
[
'className'
]);
$this
->
_options
[
'pluginTable'
]
->
bindQueryPart
(
'indexBy'
,
'lang'
);
...
...
lib/Doctrine/Plugin.php
View file @
657d6566
...
...
@@ -35,7 +35,7 @@ class Doctrine_Plugin
/**
* @var array $_options an array of plugin specific options
*/
protected
$_options
=
array
();
protected
$_options
=
array
(
'generateFiles'
=>
false
);
/**
* __get
* an alias for getOption
...
...
@@ -98,4 +98,23 @@ class Doctrine_Plugin
{
return
$this
->
_options
;
}
}
\ No newline at end of file
public
function
generateClass
(
$options
,
$columns
,
$relations
)
{
$builder
=
new
Doctrine_Import_Builder
();
if
(
$this
->
_options
[
'generateFiles'
])
{
if
(
isset
(
$this
->
_options
[
'generatePath'
])
&&
$this
->
_options
[
'generatePath'
])
{
$builder
->
setTargetPath
(
$this
->
_options
[
'generatePath'
]);
$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.'
);
}
}
else
{
$def
=
$builder
->
buildDefinition
(
$options
,
$columns
,
$relations
);
eval
(
$def
);
}
}
}
lib/Doctrine/Search.php
View file @
657d6566
...
...
@@ -30,7 +30,7 @@
* @link www.phpdoctrine.com
* @since 1.0
*/
class
Doctrine_Search
class
Doctrine_Search
extends
Doctrine_Plugin
{
protected
$_options
=
array
(
'generateFiles'
=>
false
,
'className'
=>
'%CLASS%Index'
,
...
...
@@ -48,26 +48,12 @@ class Doctrine_Search
}
}
public
function
getOption
(
$option
)
{
if
(
isset
(
$this
->
_options
[
$option
]))
{
return
$this
->
_options
[
$option
];
}
throw
new
Doctrine_Search_Exception
(
'Unknown option '
.
$option
);
}
public
function
analyze
(
$text
)
{
return
$this
->
_options
[
'analyzer'
]
->
analyze
(
$text
);
}
public
function
setOption
(
$option
,
$value
)
{
$this
->
_options
[
$option
]
=
$value
;
return
$this
;
}
/**
* updateIndex
* updates the index
...
...
@@ -198,22 +184,8 @@ class Doctrine_Search
$columns
+=
$fk
;
$builder
=
new
Doctrine_Import_Builder
();
if
(
$this
->
_options
[
'generateFiles'
])
{
if
(
isset
(
$this
->
_options
[
'generatePath'
])
&&
$this
->
_options
[
'generatePath'
])
{
$builder
->
setTargetPath
(
$this
->
_options
[
'generatePath'
]);
$builder
->
buildRecord
(
$options
,
$columns
,
$relations
);
}
else
{
throw
new
Doctrine_Search_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
);
eval
(
$def
);
}
$this
->
generateClass
(
$options
,
$columns
,
$relations
);
$this
->
_options
[
'pluginTable'
]
=
$table
->
getConnection
()
->
getTable
(
$this
->
_options
[
'className'
]);
...
...
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