Inherits Doctrine_Record_Listener.
Definition at line 34 of file Timestampable.php.
| Doctrine_Template_Listener_Timestampable::__construct |
( |
array |
$options | ) |
|
__construct
- Parameters
-
- Returns
- void
Definition at line 49 of file Timestampable.php.
{
$this->_options = $options;
}
| Doctrine_Record_Listener::getOption |
( |
|
$name | ) |
|
|
inherited |
getOption returns the value of given option
- Parameters
-
| string | $name | the name of the option |
- Returns
- mixed the value of given option
Definition at line 74 of file Listener.php.
{
if (isset($this->_options[$name])) {
return $this->_options[$name];
}
return null;
}
| Doctrine_Record_Listener::getOptions |
( |
| ) |
|
|
inherited |
getOptions returns all options of this template and the associated values
- Returns
- array all options and their values
Definition at line 62 of file Listener.php.
{
return $this->_options;
}
| Doctrine_Template_Listener_Timestampable::getTimestamp |
( |
|
$type, |
|
|
|
$conn = null |
|
) |
| |
Gets the timestamp in the correct format based on the way the behavior is configured
- Parameters
-
- Returns
- void
Definition at line 122 of file Timestampable.php.
{
$options = $this->_options[$type];
if ($options['expression'] !== false && is_string($options['expression'])) {
} else {
if ($options['type'] == 'date') {
return date($options['format'], time());
} else if ($options['type'] == 'timestamp') {
return date($options['format'], time());
} else {
return time();
}
}
}
| Doctrine_Template_Listener_Timestampable::preDqlUpdate |
( |
Doctrine_Event |
$event | ) |
|
Set the updated field for dql update queries
- Parameters
-
- Returns
- void
Definition at line 102 of file Timestampable.php.
{
if ( ! $this->_options['updated']['disabled']) {
$updatedName = $event->
getInvoker()->getTable()->getFieldName($this->_options[
'updated'][
'name']);
$field = $params['alias'] . '.' . $updatedName;
if ( ! $query->contains($field)) {
}
}
}
| Doctrine_Template_Listener_Timestampable::preInsert |
( |
Doctrine_Event |
$event | ) |
|
Set the created and updated Timestampable columns when a record is inserted
- Parameters
-
- Returns
- void
Definition at line 60 of file Timestampable.php.
{
if ( ! $this->_options['created']['disabled']) {
$createdName = $event->
getInvoker()->getTable()->getFieldName($this->_options[
'created'][
'name']);
if ( ! isset($modified[$createdName])) {
}
}
if ( ! $this->_options['updated']['disabled'] && $this->_options['updated']['onInsert']) {
$updatedName = $event->
getInvoker()->getTable()->getFieldName($this->_options[
'updated'][
'name']);
if ( ! isset($modified[$updatedName])) {
}
}
}
| Doctrine_Template_Listener_Timestampable::preUpdate |
( |
Doctrine_Event |
$event | ) |
|
Set updated Timestampable column when a record is updated
- Parameters
-
- Returns
- void
Definition at line 85 of file Timestampable.php.
{
if ( ! $this->_options['updated']['disabled']) {
$updatedName = $event->
getInvoker()->getTable()->getFieldName($this->_options[
'updated'][
'name']);
if ( ! isset($modified[$updatedName])) {
}
}
}
| Doctrine_Record_Listener::setOption |
( |
|
$name, |
|
|
|
$value = null |
|
) |
| |
|
inherited |
setOption sets an option in order to allow flexible listener
- Parameters
-
| mixed | $name | the name of the option to set |
| mixed | $value | the value of the option |
Definition at line 47 of file Listener.php.
{
if (is_array($name)) {
$this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $name);
} else {
$this->_options[$name] = $value;
}
}
The documentation for this class was generated from the following file: