This commit is contained in:
parent
af2a83484f
commit
e37ae45820
@ -29,7 +29,7 @@
|
||||
* @version $Revision$
|
||||
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
||||
*/
|
||||
class Doctrine_AuditLog
|
||||
class Doctrine_AuditLog extends Doctrine_Plugin
|
||||
{
|
||||
protected $_options = array(
|
||||
'className' => '%CLASS%Version',
|
||||
@ -44,69 +44,6 @@ class Doctrine_AuditLog
|
||||
{
|
||||
$this->_options = array_merge($this->_options, $options);
|
||||
}
|
||||
/**
|
||||
* __get
|
||||
* an alias for getOption
|
||||
*
|
||||
* @param string $option
|
||||
*/
|
||||
public function __get($option)
|
||||
{
|
||||
if (isset($this->options[$option])) {
|
||||
return $this->_options[$option];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* __isset
|
||||
*
|
||||
* @param string $option
|
||||
*/
|
||||
public function __isset($option)
|
||||
{
|
||||
return isset($this->_options[$option]);
|
||||
}
|
||||
/**
|
||||
* getOptions
|
||||
* returns all options of this table and the associated values
|
||||
*
|
||||
* @return array all options and their values
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->_options;
|
||||
}
|
||||
/**
|
||||
* setOption
|
||||
* sets an option and returns this object in order to
|
||||
* allow flexible method chaining
|
||||
*
|
||||
* @see slef::$_options for available options
|
||||
* @param string $name the name of the option to set
|
||||
* @param mixed $value the value of the option
|
||||
* @return Doctrine_AuditLog this object
|
||||
*/
|
||||
public function setOption($name, $value)
|
||||
{
|
||||
if ( ! isset($this->_options[$name])) {
|
||||
throw new Doctrine_Exception('Unknown option ' . $name);
|
||||
}
|
||||
$this->_options[$name] = $value;
|
||||
}
|
||||
/**
|
||||
* getOption
|
||||
* returns the value of given option
|
||||
*
|
||||
* @param string $name the name of the option
|
||||
* @return mixed the value of given option
|
||||
*/
|
||||
public function getOption($name)
|
||||
{
|
||||
if (isset($this->_options[$name])) {
|
||||
return $this->_options[$name];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getVersion(Doctrine_Record $record, $version)
|
||||
{
|
||||
|
@ -948,9 +948,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
|
||||
return $collection->getFirst();
|
||||
}
|
||||
case self::HYDRATE_ARRAY:
|
||||
if (!empty($collection[0])) {
|
||||
return $collection[0];
|
||||
}
|
||||
return array_shift($collection);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -36,6 +36,28 @@ class Doctrine_Plugin
|
||||
* @var array $_options an array of plugin specific options
|
||||
*/
|
||||
protected $_options = array();
|
||||
/**
|
||||
* __get
|
||||
* an alias for getOption
|
||||
*
|
||||
* @param string $option
|
||||
*/
|
||||
public function __get($option)
|
||||
{
|
||||
if (isset($this->options[$option])) {
|
||||
return $this->_options[$option];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* __isset
|
||||
*
|
||||
* @param string $option
|
||||
*/
|
||||
public function __isset($option)
|
||||
{
|
||||
return isset($this->_options[$option]);
|
||||
}
|
||||
/**
|
||||
* returns the value of an option
|
||||
*
|
||||
@ -74,6 +96,6 @@ class Doctrine_Plugin
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->_options;
|
||||
return $this->_options;
|
||||
}
|
||||
}
|
||||
|
@ -1217,7 +1217,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
|
||||
|
||||
public function load($path, $loadFields = true)
|
||||
{
|
||||
$e = Doctrine_Tokenizer::quoteExplode($path, ' MAP ');
|
||||
$e = Doctrine_Tokenizer::quoteExplode($path, ' INDEXBY ');
|
||||
|
||||
$mapWith = null;
|
||||
if (count($e) > 1) {
|
||||
@ -1420,7 +1420,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
|
||||
$table = $this->_aliasMap[$componentAlias]['table'];
|
||||
|
||||
if ( ! $table->hasColumn($e[1])) {
|
||||
throw new Doctrine_Query_Exception("Couldn't use key mapping. Column " . $e[1] . " does not exist.");
|
||||
throw new Doctrine_Query_Exception("Couldn't use key mapping. Column " . $e[1] . " does not exist.");
|
||||
}
|
||||
|
||||
$this->_aliasMap[$componentAlias]['map'] = $table->getColumnName($e[1]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user