1
0
mirror of synced 2024-12-13 14:56:01 +03:00
This commit is contained in:
jwage 2008-01-22 23:50:32 +00:00
parent f9ee88a5c3
commit 4e522ebf6b
2 changed files with 28 additions and 22 deletions

View File

@ -95,12 +95,16 @@ class Doctrine_Template_Listener_Timestampable extends Doctrine_Record_Listener
{
$options = $this->_options[$type];
if ($options['type'] == 'date') {
return date($options['format'], time());
} else if ($options['type'] == 'timestamp') {
return date($options['format'], time());
if ($options['expression'] !== false && is_string($options['expression'])) {
return new Doctrine_Expression($options['expression']);
} else {
return time();
if ($options['type'] == 'date') {
return date($options['format'], time());
} else if ($options['type'] == 'timestamp') {
return date($options['format'], time());
} else {
return time();
}
}
}
}

View File

@ -39,16 +39,18 @@ class Doctrine_Template_Timestampable extends Doctrine_Template
*
* @var string
*/
protected $_options = array('created' => array('name' => 'created_at',
'type' => 'timestamp',
'format' => 'Y-m-d H:i:s',
'disabled' => false,
'options' => array()),
'updated' => array('name' => 'updated_at',
'type' => 'timestamp',
'format' => 'Y-m-d H:i:s',
'disabled' => false,
'options' => array()));
protected $_options = array('created' => array('name' => 'created_at',
'type' => 'timestamp',
'format' => 'Y-m-d H:i:s',
'disabled' => false,
'expression' => false,
'options' => array()),
'updated' => array('name' => 'updated_at',
'type' => 'timestamp',
'format' => 'Y-m-d H:i:s',
'disabled' => false,
'expression' => false,
'options' => array()));
/**
* __construct