From f3488d17a0afe957eda8b8e8898fd9a85e9e6bf1 Mon Sep 17 00:00:00 2001 From: zYne Date: Fri, 21 Sep 2007 13:13:43 +0000 Subject: [PATCH] --- lib/Doctrine/Record.php | 13 +++++-------- lib/Doctrine/Record/Filter.php | 4 ++-- lib/Doctrine/Record/Filter/Standard.php | 10 +++++----- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/lib/Doctrine/Record.php b/lib/Doctrine/Record.php index f4f3e64ee..7c8eea199 100644 --- a/lib/Doctrine/Record.php +++ b/lib/Doctrine/Record.php @@ -772,12 +772,6 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count return $value; } - if (isset($this->_id[$lower])) { - return $this->_id[$lower]; - } - if ($name === $this->_table->getIdentifier()) { - return null; - } if (isset($this->_values[$lower])) { return $this->_values[$lower]; } @@ -793,8 +787,11 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count return $this->_references[$name]; } catch(Doctrine_Table_Exception $e) { - - throw new Doctrine_Record_Exception("Unknown property / related component '$name'."); + foreach ($this->_table->getFilters() as $filter) { + if (($value = $filter->filterGet($this, $name, $value)) !== null) { + return $value; + } + } } } /** diff --git a/lib/Doctrine/Record/Filter.php b/lib/Doctrine/Record/Filter.php index f1788593b..7db586e3c 100644 --- a/lib/Doctrine/Record/Filter.php +++ b/lib/Doctrine/Record/Filter.php @@ -39,12 +39,12 @@ abstract class Doctrine_Record_Filter * * @param mixed $name name of the property or related component */ - abstract public function filterSet($key, $value); + abstract public function filterSet(Doctrine_Record $record, $name, $value); /** * filterGet * defines an implementation for filtering the get() method of Doctrine_Record * * @param mixed $name name of the property or related component */ - abstract public function filterGet($key); + abstract public function filterGet(Doctrine_Record $record, $name); } diff --git a/lib/Doctrine/Record/Filter/Standard.php b/lib/Doctrine/Record/Filter/Standard.php index 2824aa1b4..24da62148 100644 --- a/lib/Doctrine/Record/Filter/Standard.php +++ b/lib/Doctrine/Record/Filter/Standard.php @@ -39,9 +39,9 @@ class Doctrine_Record_Filter_Standard extends Doctrine_Record_Filter * * @param mixed $name name of the property or related component */ - public function filterSet($key, $value) - { - throw new Doctrine_Record_Exception('Unknown record property / related component \'' . $key . '\'.'); + public function filterSet(Doctrine_Record $record, $name, $value) + { + throw new Doctrine_Record_Exception('Unknown record property / related component \'' . $name . '\'.'); } /** * filterGet @@ -49,8 +49,8 @@ class Doctrine_Record_Filter_Standard extends Doctrine_Record_Filter * * @param mixed $name name of the property or related component */ - public function filterGet($key) + public function filterGet(Doctrine_Record $record, $name) { - throw new Doctrine_Record_Exception('Unknown record property / related component \'' . $key . '\'.'); + throw new Doctrine_Record_Exception('Unknown record property / related component \'' . $name . '\'.'); } }