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
a593d746
Commit
a593d746
authored
Jun 25, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
dea4968a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
19 deletions
+60
-19
EventListener.php
lib/Doctrine/EventListener.php
+16
-0
Transaction.php
lib/Doctrine/Transaction.php
+44
-19
No files found.
lib/Doctrine/EventListener.php
View file @
a593d746
...
...
@@ -78,6 +78,22 @@ class Doctrine_EventListener implements Doctrine_EventListener_Interface
public
function
postTransactionBegin
(
Doctrine_Event
$event
)
{
}
public
function
preSavepointCommit
(
Doctrine_Event
$event
)
{
}
public
function
postSavepointCommit
(
Doctrine_Event
$event
)
{
}
public
function
preSavepointRollback
(
Doctrine_Event
$event
)
{
}
public
function
postSavepointRollback
(
Doctrine_Event
$event
)
{
}
public
function
preSavepointCreate
(
Doctrine_Event
$event
)
{
}
public
function
postSavepointCreate
(
Doctrine_Event
$event
)
{
}
public
function
postConnect
(
Doctrine_Event
$event
)
{
}
public
function
preConnect
(
Doctrine_Event
$event
)
...
...
lib/Doctrine/Transaction.php
View file @
a593d746
...
...
@@ -213,26 +213,37 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
public
function
beginTransaction
(
$savepoint
=
null
)
{
$this
->
conn
->
connect
();
$listener
=
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
);
if
(
!
is_null
(
$savepoint
))
{
$this
->
beginTransaction
();
$this
->
savePoints
[]
=
$savepoint
;
$this
->
createSavePoint
(
$savepoint
);
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
SAVEPOINT_CREATE
);
$listener
->
preSavepointCreate
(
$event
);
if
(
!
$event
->
skipOperation
)
{
$this
->
createSavePoint
(
$savepoint
);
}
$listener
->
postSavepointCreate
(
$event
);
}
else
{
if
(
$this
->
transactionLevel
==
0
)
{
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
TX_BEGIN
);
$
this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
preTransactionBegin
(
$event
);
$
listener
->
preTransactionBegin
(
$event
);
try
{
$this
->
conn
->
getDbh
()
->
beginTransaction
();
}
catch
(
Exception
$e
)
{
throw
new
Doctrine_Transaction_Exception
(
$e
->
getMessage
());
if
(
!
$event
->
skipOperation
)
{
try
{
$this
->
conn
->
getDbh
()
->
beginTransaction
();
}
catch
(
Exception
$e
)
{
throw
new
Doctrine_Transaction_Exception
(
$e
->
getMessage
());
}
}
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
postTransactionBegin
(
$event
);
$listener
->
postTransactionBegin
(
$event
);
}
}
...
...
@@ -261,15 +272,25 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
return
false
;
}
$listener
=
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
);
if
(
!
is_null
(
$savepoint
))
{
$this
->
transactionLevel
=
$this
->
removeSavePoints
(
$savepoint
);
$this
->
releaseSavePoint
(
$savepoint
);
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
SAVEPOINT_COMMIT
);
$listener
->
preSavepointCommit
(
$event
);
if
(
!
$event
->
skipOperation
)
{
$this
->
releaseSavePoint
(
$savepoint
);
}
$listener
->
postSavepointCommit
(
$event
);
}
else
{
if
(
$this
->
transactionLevel
==
1
)
{
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
TX_COMMIT
);
$
this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
preTransactionCommit
(
$event
);
$
listener
->
preTransactionCommit
(
$event
);
if
(
!
$event
->
skipOperation
)
{
try
{
...
...
@@ -300,7 +321,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
//$this->conn->unitOfWork->reset();
}
$
this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
postTransactionCommit
(
$event
);
$
listener
->
postTransactionCommit
(
$event
);
}
}
...
...
@@ -330,20 +351,24 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
return
false
;
}
$listener
=
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
);
if
(
!
is_null
(
$savepoint
))
{
$this
->
transactionLevel
=
$this
->
removeSavePoints
(
$savepoint
);
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
ROLLBACK_SAVEPOINT
);
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
preSavepointRollback
(
$event
);
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
SAVEPOINT_ROLLBACK
);
$
this
->
rollbackSavePoint
(
$savepoi
nt
);
$
listener
->
preSavepointRollback
(
$eve
nt
);
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
postSavepointRollback
(
$event
);
if
(
!
$event
->
skipOperation
)
{
$this
->
rollbackSavePoint
(
$savepoint
);
}
$listener
->
postSavepointRollback
(
$event
);
}
else
{
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
TX_ROLLBACK
);
$
this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
preTransactionRollback
(
$event
);
$
listener
->
preTransactionRollback
(
$event
);
if
(
!
$event
->
skipOperation
)
{
$this
->
deteles
=
array
();
...
...
@@ -356,7 +381,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
}
}
$
this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
postTransactionRollback
(
$event
);
$
listener
->
postTransactionRollback
(
$event
);
}
return
true
;
...
...
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