1
0
mirror of synced 2025-01-29 19:41:45 +03:00
This commit is contained in:
zYne 2007-09-21 13:13:43 +00:00
parent 2f7d4cbca1
commit f3488d17a0
3 changed files with 12 additions and 15 deletions

View File

@ -772,12 +772,6 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
return $value; return $value;
} }
if (isset($this->_id[$lower])) {
return $this->_id[$lower];
}
if ($name === $this->_table->getIdentifier()) {
return null;
}
if (isset($this->_values[$lower])) { if (isset($this->_values[$lower])) {
return $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]; return $this->_references[$name];
} catch(Doctrine_Table_Exception $e) { } catch(Doctrine_Table_Exception $e) {
foreach ($this->_table->getFilters() as $filter) {
throw new Doctrine_Record_Exception("Unknown property / related component '$name'."); if (($value = $filter->filterGet($this, $name, $value)) !== null) {
return $value;
}
}
} }
} }
/** /**

View File

@ -39,12 +39,12 @@ abstract class Doctrine_Record_Filter
* *
* @param mixed $name name of the property or related component * @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 * filterGet
* defines an implementation for filtering the get() method of Doctrine_Record * defines an implementation for filtering the get() method of Doctrine_Record
* *
* @param mixed $name name of the property or related component * @param mixed $name name of the property or related component
*/ */
abstract public function filterGet($key); abstract public function filterGet(Doctrine_Record $record, $name);
} }

View File

@ -39,9 +39,9 @@ class Doctrine_Record_Filter_Standard extends Doctrine_Record_Filter
* *
* @param mixed $name name of the property or related component * @param mixed $name name of the property or related component
*/ */
public function filterSet($key, $value) public function filterSet(Doctrine_Record $record, $name, $value)
{ {
throw new Doctrine_Record_Exception('Unknown record property / related component \'' . $key . '\'.'); throw new Doctrine_Record_Exception('Unknown record property / related component \'' . $name . '\'.');
} }
/** /**
* filterGet * filterGet
@ -49,8 +49,8 @@ class Doctrine_Record_Filter_Standard extends Doctrine_Record_Filter
* *
* @param mixed $name name of the property or related component * @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 . '\'.');
} }
} }