Author: jwage
Date: 2008-09-26 01:00:24 +0100 (Fri, 26 Sep 2008)
New Revision: 4987
Modified:
branches/1.0/lib/Doctrine/Template/Listener/Timestampable.php
Log:
[1.0] fixes #1473 Fixes issue with not being able to set created and updated at
values manually with Timestampable
Modified: branches/1.0/lib/Doctrine/Template/Listener/Timestampable.php
===================================================================
--- branches/1.0/lib/Doctrine/Template/Listener/Timestampable.php
2008-09-25 23:51:36 UTC (rev 4986)
+++ branches/1.0/lib/Doctrine/Template/Listener/Timestampable.php
2008-09-26 00:00:24 UTC (rev 4987)
@@ -61,12 +61,16 @@
{
if( ! $this->_options['created']['disabled']) {
$createdName =
$event->getInvoker()->getTable()->getFieldName($this->_options['created']['name']);
- $event->getInvoker()->$createdName =
$this->getTimestamp('created');
+ if ( ! $event->getInvoker()->$createdName) {
+ $event->getInvoker()->$createdName =
$this->getTimestamp('created');
+ }
}
if( ! $this->_options['updated']['disabled'] &&
$this->_options['updated']['onInsert']) {
$updatedName =
$event->getInvoker()->getTable()->getFieldName($this->_options['updated']['name']);
- $event->getInvoker()->$updatedName =
$this->getTimestamp('updated');
+ if ( ! $event->getInvoker()->$updatedName) {
+ $event->getInvoker()->$updatedName =
$this->getTimestamp('updated');
+ }
}
}
@@ -80,7 +84,9 @@
{
if( ! $this->_options['updated']['disabled']) {
$updatedName =
$event->getInvoker()->getTable()->getFieldName($this->_options['updated']['name']);
- $event->getInvoker()->$updatedName =
$this->getTimestamp('updated');
+ if ( ! $event->getInvoker()->$updatedName) {
+ $event->getInvoker()->$updatedName =
$this->getTimestamp('updated');
+ }
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---