From d2d04d950aa4c81c04a6cda2a234c7097f5cb9bb Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 31 Mar 2009 19:34:37 +0000 Subject: [PATCH] BUGFIX Consistently returning boolean values in DataObject->hasDatabaseField() MINOR Documentation in DataObject git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73885 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/DataObject.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/model/DataObject.php b/core/model/DataObject.php index 9f38ee7d5..edafc664a 100644 --- a/core/model/DataObject.php +++ b/core/model/DataObject.php @@ -2,6 +2,12 @@ /** * A single database record & abstract class for the data-access-model. * + *

Extensions and Decorators

+ * + * See {@link Extension} and {@link DataObjectDecorator}. + * + *

Permission Control

+ * * Object-level access control by {@link Permission}. Permission codes are arbitrary * strings which can be selected on a group-by-group basis. * @@ -53,6 +59,10 @@ * If any public method on this class is prefixed with an underscore, * the results are cached in memory through {@link cachedCall()}. * + * + * @todo Add instance specific removeExtension() which undos loadExtraStatics() + * and defineMethods() + * * @package sapphire * @subpackage model */ @@ -1934,6 +1944,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * @return boolean */ public function hasDatabaseField($field) { + // Add base fields which are not defined in static $db $fixedFields = array( 'ID' => 'Int', 'ClassName' => 'Enum', @@ -1943,8 +1954,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity 'Version' => $this->hasExtension('Versioned') ? 'Int' : false, ); - // Add base fields which are not defined in static $db - if(isset($fixedFields[$field])) return (bool)$fixedFields[$field]; + if(isset($fixedFields[$field])) return true; return array_key_exists($field, $this->inheritedDatabaseFields()); }