From 8e884437fecc75a3a53ec4b2295d950385301c2b Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 12 Mar 2008 09:21:49 +0000 Subject: [PATCH] FEATURE added hasDatabaseField() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@50942 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/DataObject.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/model/DataObject.php b/core/model/DataObject.php index 46f12b75f..1d85a8a2d 100644 --- a/core/model/DataObject.php +++ b/core/model/DataObject.php @@ -1222,6 +1222,17 @@ class DataObject extends ViewableData implements DataObjectInterface { return array_key_exists($field, $this->record); } + /** + * Returns true if the given field exists as a database column + * + * @param string $field Name of the field + * + * @return boolean + */ + public function hasDatabaseField($field) { + return array_key_exists($field, $this->databaseFields()); + } + /** * Returns true if the member is allowed to do the given action. *