1
0
mirror of https://github.com/silverstripe/silverstripe-framework synced 2024-10-22 14:05:37 +02:00

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
This commit is contained in:
Ingo Schommer 2009-03-31 19:34:37 +00:00
parent 9eb57d064e
commit d2d04d950a

View File

@ -2,6 +2,12 @@
/**
* A single database record & abstract class for the data-access-model.
*
* <h2>Extensions and Decorators</h2>
*
* See {@link Extension} and {@link DataObjectDecorator}.
*
* <h2>Permission Control</h2>
*
* 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());
}