From 4aa1fc2d2cafd1c90401896cefb03e64b530a59c Mon Sep 17 00:00:00 2001 From: Ed Chipman Date: Thu, 7 Jul 2016 15:55:37 -0300 Subject: [PATCH 1/2] BUGFIX: Changed form fields that call renderWith in Field() to call parent::Field() instead (#5783) --- forms/CheckboxSetField.php | 4 +--- forms/ListboxField.php | 2 +- forms/OptionsetField.php | 4 +--- forms/TreeDropdownField.php | 2 +- forms/TreeMultiselectField.php | 2 +- forms/UploadField.php | 4 ++-- 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/forms/CheckboxSetField.php b/forms/CheckboxSetField.php index e72b1f516..55eb8cf2b 100644 --- a/forms/CheckboxSetField.php +++ b/forms/CheckboxSetField.php @@ -54,9 +54,7 @@ class CheckboxSetField extends OptionsetField { 'Options' => $this->getOptions() )); - return $this->customise($properties)->renderWith( - $this->getTemplates() - ); + return FormField::Field($properties); } /** diff --git a/forms/ListboxField.php b/forms/ListboxField.php index 0989da05c..d8aac5b0f 100644 --- a/forms/ListboxField.php +++ b/forms/ListboxField.php @@ -102,7 +102,7 @@ class ListboxField extends DropdownField { 'Options' => new ArrayList($options) )); - return $this->customise($properties)->renderWith($this->getTemplates()); + return FormField::Field($properties); } public function getAttributes() { diff --git a/forms/OptionsetField.php b/forms/OptionsetField.php index 42c1bab84..fb37c075b 100644 --- a/forms/OptionsetField.php +++ b/forms/OptionsetField.php @@ -83,9 +83,7 @@ class OptionsetField extends DropdownField { 'Options' => new ArrayList($options) )); - return $this->customise($properties)->renderWith( - $this->getTemplates() - ); + return FormField::Field($properties); } /** diff --git a/forms/TreeDropdownField.php b/forms/TreeDropdownField.php index cf3b7bf2a..78339661a 100644 --- a/forms/TreeDropdownField.php +++ b/forms/TreeDropdownField.php @@ -248,7 +248,7 @@ class TreeDropdownField extends FormField { ) ); - return $this->customise($properties)->renderWith('TreeDropdownField'); + return parent::Field($properties); } public function extraClass() { diff --git a/forms/TreeMultiselectField.php b/forms/TreeMultiselectField.php index 5f0f7f302..1f3965f1a 100644 --- a/forms/TreeMultiselectField.php +++ b/forms/TreeMultiselectField.php @@ -135,7 +135,7 @@ class TreeMultiselectField extends TreeDropdownField { 'Value' => $value ) ); - return $this->customise($properties)->renderWith('TreeDropdownField'); + return FormField::Field($properties); } /** diff --git a/forms/UploadField.php b/forms/UploadField.php index 57926dc77..9a9674b62 100644 --- a/forms/UploadField.php +++ b/forms/UploadField.php @@ -972,11 +972,11 @@ class UploadField extends FileField { } $mergedConfig = array_merge($config, $this->ufConfig); - return $this->customise(array( + return parent::Field(array( 'configString' => str_replace('"', """, Convert::raw2json($mergedConfig)), 'config' => new ArrayData($mergedConfig), 'multiple' => $allowedMaxFileNumber !== 1 - ))->renderWith($this->getTemplates()); + )); } /** From 04a4d7937ec6ca6c968b50780bace97821f20bfa Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 8 Jul 2016 09:32:43 +1200 Subject: [PATCH 2/2] DOCS Update 02_Relations (#5785) * Code formatting on some variable names * Add example for removing scaffolded parent relation fields --- .../02_Developer_Guides/00_Model/02_Relations.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/en/02_Developer_Guides/00_Model/02_Relations.md b/docs/en/02_Developer_Guides/00_Model/02_Relations.md index b3cb2bd1c..83ddbbae3 100644 --- a/docs/en/02_Developer_Guides/00_Model/02_Relations.md +++ b/docs/en/02_Developer_Guides/00_Model/02_Relations.md @@ -147,7 +147,7 @@ you will get an instance of [api:HasManyList] rather than the object. echo $player->FirstName; } -To specify multiple $has_manys to the same object you can use dot notation to distinguish them like below: +To specify multiple `$has_many` to the same object you can use dot notation to distinguish them like below: :::php removeByName(array('ManagerID', 'CleanerID')); + return $fields; + } + ## belongs_to Defines a 1-to-1 relationship with another object, which declares the other end of the relationship with a -corresponding $has_one. A single database column named `ID` will be created in the object with the +corresponding `$has_one`. A single database column named `ID` will be created in the object with the `$has_one`, but the $belongs_to by itself will not create a database field. This field will hold the ID of the object declaring the `$belongs_to`. -Similarly with $has_many, dot notation can be used to explicitly specify the `$has_one` which refers to this relation. +Similarly with `$has_many`, dot notation can be used to explicitly specify the `$has_one` which refers to this relation. This is not mandatory unless the relationship would be otherwise ambiguous. :::php