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
ee07246d
Commit
ee07246d
authored
Jun 24, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
401c3fe9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
19 deletions
+32
-19
UnitOfWork.php
lib/Doctrine/Connection/UnitOfWork.php
+16
-8
Event.php
lib/Doctrine/Event.php
+8
-3
Record.php
lib/Doctrine/Record.php
+8
-8
No files found.
lib/Doctrine/Connection/UnitOfWork.php
View file @
ee07246d
...
...
@@ -140,8 +140,10 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
public
function
save
(
Doctrine_Record
$record
)
{
$record
->
getTable
()
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onPreSave
(
$record
);
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
SAVE
);
$record
->
preSave
();
$record
->
preSave
(
$event
);
switch
(
$record
->
state
())
{
case
Doctrine_Record
::
STATE_TDIRTY
:
...
...
@@ -157,7 +159,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
break
;
}
$record
->
postSave
();
$record
->
postSave
(
$event
);
$record
->
getTable
()
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onSave
(
$record
);
}
...
...
@@ -178,13 +180,15 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record
->
getTable
()
->
getListener
()
->
onPreDelete
(
$record
);
$record
->
preDelete
();
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
DELETE
);
$record
->
preDelete
(
$event
);
$this
->
deleteComposites
(
$record
);
$this
->
conn
->
transaction
->
addDelete
(
$record
);
$record
->
postDelete
();
$record
->
postDelete
(
$event
);
$record
->
getTable
()
->
getListener
()
->
onDelete
(
$record
);
...
...
@@ -329,7 +333,9 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
{
$record
->
getTable
()
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onPreUpdate
(
$record
);
$record
->
preUpdate
();
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
UPDATE
);
$record
->
preUpdate
(
$event
);
$array
=
$record
->
getPrepared
();
...
...
@@ -368,7 +374,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record
->
assignIdentifier
(
true
);
$record
->
postUpdate
();
$record
->
postUpdate
(
$event
);
$record
->
getTable
()
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onUpdate
(
$record
);
...
...
@@ -385,7 +391,9 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
// listen the onPreInsert event
$record
->
getTable
()
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onPreInsert
(
$record
);
$record
->
preInsert
();
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
INSERT
);
$record
->
preInsert
(
$event
);
$array
=
$record
->
getPrepared
();
...
...
@@ -425,7 +433,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record
->
assignIdentifier
(
true
);
}
$record
->
postInsert
();
$record
->
postInsert
(
$event
);
// listen the onInsert event
$table
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onInsert
(
$record
);
...
...
lib/Doctrine/Event.php
View file @
ee07246d
...
...
@@ -44,8 +44,13 @@ class Doctrine_Event
const
CONNECT
=
8
;
const
FETCH
=
9
;
const
FETCHALL
=
10
;
const
DELETE
=
11
;
const
SAVE
=
12
;
const
UPDATE
=
13
;
const
INSERT
=
14
;
/**
* @var
Doctrine_Db
$invoker the handler which invoked this event
* @var
mixed
$invoker the handler which invoked this event
*/
protected
$invoker
;
/**
...
...
@@ -57,7 +62,7 @@ class Doctrine_Event
*/
protected
$params
;
/**
* @see Doctrine_
Db_
Event constants
* @see Doctrine_Event constants
* @var integer $code the event code
*/
protected
$code
;
...
...
@@ -81,7 +86,7 @@ class Doctrine_Event
$this
->
invoker
=
$invoker
;
$this
->
code
=
$code
;
$this
->
query
=
$query
;
$this
->
params
=
$params
;
$this
->
params
=
$params
;
}
/**
* getQuery
...
...
lib/Doctrine/Record.php
View file @
ee07246d
...
...
@@ -294,53 +294,53 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
* Empty template method to provide concrete Record classes with the possibility
* to hook into the saving procedure.
*/
public
function
preSave
()
public
function
preSave
(
$event
)
{
}
/**
* Empty template method to provide concrete Record classes with the possibility
* to hook into the saving procedure.
*/
public
function
postSave
()
public
function
postSave
(
$event
)
{
}
/**
* Empty template method to provide concrete Record classes with the possibility
* to hook into the deletion procedure.
*/
public
function
preDelete
()
public
function
preDelete
(
$event
)
{
}
/**
* Empty template method to provide concrete Record classes with the possibility
* to hook into the deletion procedure.
*/
public
function
postDelete
()
public
function
postDelete
(
$event
)
{
}
/**
* 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
()
public
function
preUpdate
(
$event
)
{
}
/**
* 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
()
public
function
postUpdate
(
$event
)
{
}
/**
* 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
()
public
function
preInsert
(
$event
)
{
}
/**
* 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
()
public
function
postInsert
(
$event
)
{
}
/**
* 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