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
782cbe37
Commit
782cbe37
authored
Jun 24, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new template methods
parent
e057ab7d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
5 deletions
+73
-5
UnitOfWork.php
lib/Doctrine/Connection/UnitOfWork.php
+16
-0
Record.php
lib/Doctrine/Record.php
+57
-5
No files found.
lib/Doctrine/Connection/UnitOfWork.php
View file @
782cbe37
...
...
@@ -141,6 +141,8 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
{
$record
->
getTable
()
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onPreSave
(
$record
);
$record
->
preSave
();
switch
(
$record
->
state
())
{
case
Doctrine_Record
::
STATE_TDIRTY
:
$this
->
insert
(
$record
);
...
...
@@ -155,6 +157,8 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
break
;
}
$record
->
postSave
();
$record
->
getTable
()
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onSave
(
$record
);
}
/**
...
...
@@ -174,10 +178,14 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record
->
getTable
()
->
getListener
()
->
onPreDelete
(
$record
);
$record
->
preDelete
();
$this
->
deleteComposites
(
$record
);
$this
->
conn
->
transaction
->
addDelete
(
$record
);
$record
->
postDelete
();
$record
->
getTable
()
->
getListener
()
->
onDelete
(
$record
);
$record
->
state
(
Doctrine_Record
::
STATE_TCLEAN
);
...
...
@@ -321,6 +329,8 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
{
$record
->
getTable
()
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onPreUpdate
(
$record
);
$record
->
preUpdate
();
$array
=
$record
->
getPrepared
();
if
(
empty
(
$array
))
{
...
...
@@ -358,6 +368,8 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record
->
assignIdentifier
(
true
);
$record
->
postUpdate
();
$record
->
getTable
()
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onUpdate
(
$record
);
return
true
;
...
...
@@ -373,6 +385,8 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
// listen the onPreInsert event
$record
->
getTable
()
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onPreInsert
(
$record
);
$record
->
preInsert
();
$array
=
$record
->
getPrepared
();
if
(
empty
(
$array
))
{
...
...
@@ -411,6 +425,8 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record
->
assignIdentifier
(
true
);
}
$record
->
postInsert
();
// listen the onInsert event
$table
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onInsert
(
$record
);
...
...
lib/Doctrine/Record.php
View file @
782cbe37
...
...
@@ -275,21 +275,73 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
* validations that are neccessary.
*/
protected
function
validate
()
{}
{
}
/**
* Empty temp
al
te method to provide concrete Record classes with the possibility
* Empty temp
la
te method to provide concrete Record classes with the possibility
* to hook into the validation procedure only when the record is going to be
* updated.
*/
protected
function
validateOnUpdate
()
{}
{
}
/**
* Empty temp
al
te method to provide concrete Record classes with the possibility
* Empty temp
la
te method to provide concrete Record classes with the possibility
* to hook into the validation procedure only when the record is going to be
* inserted into the data store the first time.
*/
protected
function
validateOnInsert
()
{}
{
}
/**
* Empty template method to provide concrete Record classes with the possibility
* to hook into the saving procedure.
*/
public
function
preSave
()
{
}
/**
* Empty template method to provide concrete Record classes with the possibility
* to hook into the saving procedure.
*/
public
function
postSave
()
{
}
/**
* Empty template method to provide concrete Record classes with the possibility
* to hook into the deletion procedure.
*/
public
function
preDelete
()
{
}
/**
* Empty template method to provide concrete Record classes with the possibility
* to hook into the deletion procedure.
*/
public
function
postDelete
()
{
}
/**
* Empty template method to provide concrete Record classes with the possibility
* to hook into the saving procedure only when the record is going to be
* updated.
*/
public
function
preUpdate
()
{
}
/**
* Empty template method to provide concrete Record classes with the possibility
* to hook into the saving procedure only when the record is going to be
* updated.
*/
public
function
postUpdate
()
{
}
/**
* Empty template method to provide concrete Record classes with the possibility
* to hook into the saving procedure only when the record is going to be
* inserted into the data store the first time.
*/
public
function
preInsert
()
{
}
/**
* Empty template method to provide concrete Record classes with the possibility
* to hook into the saving procedure only when the record is going to be
* inserted into the data store the first time.
*/
public
function
postInsert
()
{
}
/**
* getErrorStack
*
...
...
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