I'm using sf 1,2,7 with doctrine.
We have a admin gen backend to create pdv object.
The save method of my pdv object is based on a transaction.
In this save method a call to webservice is made.
This call is wrapped in a try catch block.
Depending on the call result the transaction is either:
-rollback and my pdv object is not saved
(case of an exception thrown by the ws call)
-commit and my pdv object is saved
This is the normal process.
But in case of error resulting of the webservice call I must also log this erreur in my db.
Here comme my pb:
Just after the rollback I try to save my error this way:
- Code: Select all
...
...
...
$log = new errors();
$log->msg = $exception->getMessage();
$log->save();
But my error object is not saved!
I see the table error's increment increases.
But the object Is not recorded.
Do I miss something?
Edit:
The only way I've found to have my error recorded is add this code before the error object saving process:
- Code: Select all
$conn->close();
$conn->connect();
$this->getTable()->setConnection($conn);
$conn->beginTransaction();
But the draw back of this method is taht it shutdown the db connexion to open a new one.
Which make me lose some important session information like the users flashes messages...
Any help would be appreciated.
