Commit cc998bf1 authored by zYne's avatar zYne

--no commit message

--no commit message
parent 7bacdf07
...@@ -36,7 +36,7 @@ class Doctrine_AuditLog ...@@ -36,7 +36,7 @@ class Doctrine_AuditLog
'deleteTrigger' => '%TABLE%_ddt', 'deleteTrigger' => '%TABLE%_ddt',
'updateTrigger' => '%TABLE%_dut', 'updateTrigger' => '%TABLE%_dut',
'versionTable' => '%TABLE%_dvt', 'versionTable' => '%TABLE%_dvt',
'identifier' => '__version', 'versionColumn' => 'version',
); );
protected $_table; protected $_table;
...@@ -54,7 +54,7 @@ class Doctrine_AuditLog ...@@ -54,7 +54,7 @@ class Doctrine_AuditLog
public function __get($option) public function __get($option)
{ {
if (isset($this->options[$option])) { if (isset($this->options[$option])) {
return $this->options[$option]; return $this->_options[$option];
} }
return null; return null;
} }
...@@ -65,7 +65,7 @@ class Doctrine_AuditLog ...@@ -65,7 +65,7 @@ class Doctrine_AuditLog
*/ */
public function __isset($option) public function __isset($option)
{ {
return isset($this->options[$option]); return isset($this->_options[$option]);
} }
/** /**
* getOptions * getOptions
...@@ -75,7 +75,7 @@ class Doctrine_AuditLog ...@@ -75,7 +75,7 @@ class Doctrine_AuditLog
*/ */
public function getOptions() public function getOptions()
{ {
return $this->options; return $this->_options;
} }
/** /**
* setOption * setOption
...@@ -92,7 +92,7 @@ class Doctrine_AuditLog ...@@ -92,7 +92,7 @@ class Doctrine_AuditLog
if ( ! isset($this->_options[$name])) { if ( ! isset($this->_options[$name])) {
throw new Doctrine_Exception('Unknown option ' . $name); throw new Doctrine_Exception('Unknown option ' . $name);
} }
$this->options[$name] = $value; $this->_options[$name] = $value;
} }
/** /**
* getOption * getOption
...@@ -103,8 +103,8 @@ class Doctrine_AuditLog ...@@ -103,8 +103,8 @@ class Doctrine_AuditLog
*/ */
public function getOption($name) public function getOption($name)
{ {
if (isset($this->options[$name])) { if (isset($this->_options[$name])) {
return $this->options[$name]; return $this->_options[$name];
} }
return null; return null;
} }
...@@ -142,13 +142,6 @@ class Doctrine_AuditLog ...@@ -142,13 +142,6 @@ class Doctrine_AuditLog
} }
$data['columns'] = array_merge(array($this->_options['identifier'] =>
array('type' => 'integer',
'primary' => true,
'length' => 8,
'autoinc' => true)), $data['columns']);
$className = str_replace('%CLASS%', $this->_table->getComponentName(), $this->_options['className']); $className = str_replace('%CLASS%', $this->_table->getComponentName(), $this->_options['className']);
$definition = 'class ' . $className $definition = 'class ' . $className
. ' extends Doctrine_Record { ' . ' extends Doctrine_Record { '
...@@ -161,10 +154,11 @@ class Doctrine_AuditLog ...@@ -161,10 +154,11 @@ class Doctrine_AuditLog
'foreign' => $this->_table->getIdentifier(), 'foreign' => $this->_table->getIdentifier(),
'type' => Doctrine_Relation::MANY)); 'type' => Doctrine_Relation::MANY));
print $definition;
$this->_table->addListener(new Doctrine_AuditLog_Listener($this));
eval( $definition ); eval( $definition );
$data['options']['primary'] = array($this->_options['identifier']);
$conn->export->createTable($data['tableName'], $data['columns'], $data['options']); $conn->export->createTable($data['tableName'], $data['columns'], $data['options']);
} }
......
...@@ -175,7 +175,9 @@ abstract class Doctrine_Configurable ...@@ -175,7 +175,9 @@ abstract class Doctrine_Configurable
*/ */
public function addListener($listener, $name = null) public function addListener($listener, $name = null)
{ {
if ( ! ($this->attributes[Doctrine::ATTR_LISTENER] instanceof Doctrine_EventListener_Chain)) { if ( ! isset($this->attributes[Doctrine::ATTR_LISTENER]) ||
! ($this->attributes[Doctrine::ATTR_LISTENER] instanceof Doctrine_EventListener_Chain)) {
$this->attributes[Doctrine::ATTR_LISTENER] = new Doctrine_EventListener_Chain(); $this->attributes[Doctrine::ATTR_LISTENER] = new Doctrine_EventListener_Chain();
} }
$this->attributes[Doctrine::ATTR_LISTENER]->add($listener, $name); $this->attributes[Doctrine::ATTR_LISTENER]->add($listener, $name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment