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
1633b07f
Commit
1633b07f
authored
Jul 17, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
163c1aaa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
12 deletions
+61
-12
Record.php
lib/Doctrine/Record.php
+35
-1
Search.php
lib/Doctrine/Search.php
+10
-3
Table.php
lib/Doctrine/Table.php
+16
-8
No files found.
lib/Doctrine/Record.php
View file @
1633b07f
...
...
@@ -1370,7 +1370,10 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
}
public
function
revert
(
$version
)
{
$data
=
$this
->
_table
->
getAuditLog
()
->
getVersion
(
$this
,
$version
);
$data
=
$this
->
_table
->
getTemplate
(
'Doctrine_Template_Versionable'
)
->
getAuditLog
()
->
getVersion
(
$this
,
$version
);
$this
->
_data
=
$data
[
0
];
}
...
...
@@ -1387,6 +1390,37 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
$tpl
->
setTableDefinition
();
return
$this
;
}
public
function
actAs
(
$tpl
,
$options
=
array
())
{
if
(
!
is_object
(
$tpl
))
{
if
(
class_exists
(
$tpl
))
{
$tpl
=
new
$tpl
(
$options
);
}
else
{
$className
=
'Doctrine_Template_'
.
ucwords
(
strtolower
(
$tpl
));
if
(
!
class_exists
(
$className
))
{
throw
new
Doctrine_Record_Exception
(
"Couldn't load plugin."
);
}
$tpl
=
new
$className
(
$options
);
}
}
if
(
!
(
$tpl
instanceof
Doctrine_Template
))
{
throw
new
Doctrine_Record_Exception
(
'Loaded plugin class is not an istance of Doctrine_Template.'
);
}
$className
=
get_class
(
$tpl
);
$this
->
_table
->
addTemplate
(
$className
,
$tpl
);
$tpl
->
setTable
(
$this
->
_table
);
$tpl
->
setUp
();
$tpl
->
setTableDefinition
();
return
$this
;
}
/**
* used to delete node from tree - MUST BE USE TO DELETE RECORD IF TABLE ACTS AS TREE
*
...
...
lib/Doctrine/Search.php
View file @
1633b07f
...
...
@@ -33,6 +33,7 @@
class
Doctrine_Search
{
protected
$_options
=
array
(
'generateFiles'
=>
true
);
public
function
__construct
(
array
$options
)
{
...
...
@@ -98,12 +99,17 @@ class Doctrine_Search
$columns
=
array
(
'keyword'
=>
array
(
'type'
=>
'string'
,
'length'
=>
200
,
'notnull'
=>
true
),
'notnull'
=>
true
,
'primary'
=>
true
,
),
'field'
=>
array
(
'type'
=>
'string'
,
'length'
=>
50
,
'notnull'
=>
true
),
'notnull'
=>
true
,
'primary'
=>
true
),
'position'
=>
array
(
'type'
=>
'integer'
,
'length'
=>
8
));
'length'
=>
8
,
'primary'
=>
true
,
));
$id
=
$table
->
getIdentifier
();
...
...
@@ -120,6 +126,7 @@ class Doctrine_Search
$col
=
strtolower
(
$name
.
'_'
.
$column
);
$def
[
'primary'
]
=
true
;
$fk
[
$col
]
=
$def
;
}
...
...
lib/Doctrine/Table.php
View file @
1633b07f
...
...
@@ -154,9 +154,11 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
*/
protected
$_parser
;
/**
* @var
Doctrine_AuditLog $_auditLog
* @var
array $_templates an array containing all templates attached to this table
*/
protected
$_auditLog
;
protected
$_templates
;
/**
* the constructor
* @throws Doctrine_Connection_Exception if there are no opened connections
...
...
@@ -1238,13 +1240,19 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
public
function
isTree
()
{
return
(
!
is_null
(
$this
->
options
[
'treeImpl'
]))
?
true
:
false
;
}
public
function
getAuditLog
()
public
function
getTemplate
(
$template
)
{
if
(
!
isset
(
$this
->
_auditLog
))
{
$this
->
_auditLog
=
new
Doctrine_AuditLog
(
$this
);
}
return
$this
->
_auditLog
;
if
(
!
isset
(
$this
->
_templates
[
$template
]))
{
throw
new
Doctrine_Table_Exception
(
'Template '
.
$template
.
' not loaded'
);
}
return
$this
->
_templates
[
$template
];
}
public
function
addTemplate
(
$template
,
Doctrine_Template
$impl
)
{
$this
->
_templates
[
$template
]
=
$impl
;
}
/**
* returns a string representation of this object
...
...
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