From e55554d087e9e2cc5d36dcaee3eca17ce75c358a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 9 Jan 2017 16:50:40 +1300 Subject: [PATCH] Clarify DataObject::__construct() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The $record argument should NOT be used for object construction, since it bypasses setters. While the original PHPDoc hints at this (“internal systems”), it doesn’t make it clear enough. --- model/DataObject.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/model/DataObject.php b/model/DataObject.php index 82869dd5d..afa2b6fba 100644 --- a/model/DataObject.php +++ b/model/DataObject.php @@ -425,8 +425,9 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity /** * Construct a new DataObject. * - * @param array|null $record This will be null for a new database record. Alternatively, you can pass an array of - * field values. Normally this contructor is only used by the internal systems that get objects from the database. + * @param array|null $record Used internally for rehydrating an object from database content. + * Bypasses setters on this class, and hence should not be used + * for populating data on new records. * @param boolean $isSingleton This this to true if this is a singleton() object, a stub for calling methods. * Singletons don't have their defaults set. */