diff --git a/lib/Doctrine/AuditLog.php b/lib/Doctrine/AuditLog.php index fbac82365..e813c209b 100644 --- a/lib/Doctrine/AuditLog.php +++ b/lib/Doctrine/AuditLog.php @@ -29,7 +29,7 @@ * @version $Revision$ * @author Konsta Vesterinen */ -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) { diff --git a/lib/Doctrine/Hydrate.php b/lib/Doctrine/Hydrate.php index 72df1e3e7..b1686fd01 100644 --- a/lib/Doctrine/Hydrate.php +++ b/lib/Doctrine/Hydrate.php @@ -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; diff --git a/lib/Doctrine/Plugin.php b/lib/Doctrine/Plugin.php index 03c71e862..41cc3b7ba 100644 --- a/lib/Doctrine/Plugin.php +++ b/lib/Doctrine/Plugin.php @@ -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; } } diff --git a/lib/Doctrine/Query.php b/lib/Doctrine/Query.php index 52bb3ce4a..e12a22c60 100644 --- a/lib/Doctrine/Query.php +++ b/lib/Doctrine/Query.php @@ -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]);