BUGFIX: Fixed DataObject::dbObject() operation with CompositeDbFields

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63509 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-10-02 03:28:01 +00:00
parent 2a392ef61c
commit a231c15669

View File

@ -1909,8 +1909,12 @@ class DataObject extends ViewableData implements DataObjectInterface {
* @return DBField The field as a DBField object
*/
public function dbObject($fieldName) {
// If we have a CompositeDBField object in $this->record, then return that
if(isset($this->record[$fieldName]) && is_object($this->record[$fieldName])) {
return $this->record[$fieldName];
// Special case for ID field
if($fieldName == 'ID') {
} else if($fieldName == 'ID') {
return new PrimaryKey($fieldName, $this);
// General casting information for items in $db or $casting