`ID"" will to be created in the child-class. As
-you can see from the previous example, `$has_many` goes hand in hand with `$has_one`.
+Defines 1-to-many joins. As you can see from the previous example, `$has_many` goes hand in hand with `$has_one`.
Please specify a $has_one-relationship on the related child-class as well, in order to have the necessary accessors
@@ -184,7 +185,7 @@ available on both ends.
);
}
-Much like the `has_one` relationship, `mant_many` can be navigated through the `ORM` as well. The only difference being
+Much like the `has_one` relationship, `many_many` can be navigated through the `ORM` as well. The only difference being
you will get an instance of [api:ManyManyList] rather than the object.
:::php
@@ -203,6 +204,11 @@ The relationship can also be navigated in [templates](../templates).
<% end_if %>
<% end_with %>
+## many_many or belongs_many_many?
+
+If you're unsure about whether an object should take on `many_many` or `belongs_many_many`, the best way to think about it is that the object where the relationship will be edited (i.e. via checkboxes) should contain the `many_many`. For instance, in a `many_many` of Product => Categories, the `Product` should contain the `many_many`, because it is much more likely that the user will select Categories for a Product than vice-versa.
+
+
## Adding relations
Adding new items to a relations works the same, regardless if you're editing a **has_many** or a **many_many**. They are
diff --git a/docs/en/02_Developer_Guides/00_Model/03_Lists.md b/docs/en/02_Developer_Guides/00_Model/03_Lists.md
index b87a86bce..11f830894 100644
--- a/docs/en/02_Developer_Guides/00_Model/03_Lists.md
+++ b/docs/en/02_Developer_Guides/00_Model/03_Lists.md
@@ -1,5 +1,5 @@
title: Managing Lists
-summary: Learn how to manipulate SS_List objects.
+summary: The SS_List interface allows you to iterate through and manipulate a list of objects.
# Managing Lists
@@ -9,7 +9,7 @@ modify.
## Iterating over the list.
-[api:SS_List] implements `IteratorAggregate` allowing you to loop over the instance.
+[api:SS_List] implements `IteratorAggregate`, allowing you to loop over the instance.
:::php
$members = Member::get();
diff --git a/docs/en/02_Developer_Guides/00_Model/04_Data_Types_and_Casting.md b/docs/en/02_Developer_Guides/00_Model/04_Data_Types_and_Casting.md
index b077740a4..6a31ea375 100644
--- a/docs/en/02_Developer_Guides/00_Model/04_Data_Types_and_Casting.md
+++ b/docs/en/02_Developer_Guides/00_Model/04_Data_Types_and_Casting.md
@@ -1,5 +1,5 @@
title: Data Types, Overloading and Casting
-summary: Documentation on how data is stored going in, coming out of the ORM and how to modify it.
+summary: Learn how how data is stored going in and coming out of the ORM and how to modify it.
# Data Types and Casting
@@ -7,7 +7,7 @@ Each model in a SilverStripe [api:DataObject] will handle data at some point. Th
the ones defined in a `$db` array or simply a method that returns data for the template.
A Data Type is represented in SilverStripe by a [api:DBField] subclass. The class is responsible for telling the ORM
-about how to store it's data in the database and how to format the information coming out of the database.
+about how to store its data in the database and how to format the information coming out of the database, i.e. on a template.
In the `Player` example, we have four database columns each with a different data type (Int, Varchar).
diff --git a/docs/en/02_Developer_Guides/00_Model/05_Extending_DataObjects.md b/docs/en/02_Developer_Guides/00_Model/05_Extending_DataObjects.md
index db8f0f61f..e10ec2267 100644
--- a/docs/en/02_Developer_Guides/00_Model/05_Extending_DataObjects.md
+++ b/docs/en/02_Developer_Guides/00_Model/05_Extending_DataObjects.md
@@ -12,7 +12,7 @@ data records.
## onBeforeWrite
-You can customize saving-behaviour for each DataObject, e.g. for adding workflow or data customization. The function is
+You can customize saving-behavior for each DataObject, e.g. for adding workflow or data customization. The function is
triggered when calling *write()* to save the object to the database. This includes saving a page in the CMS or altering
a `ModelAdmin` record.
diff --git a/docs/en/02_Developer_Guides/00_Model/06_SearchFilters.md b/docs/en/02_Developer_Guides/00_Model/06_SearchFilters.md
index 41724d67e..e0b1f9b4c 100644
--- a/docs/en/02_Developer_Guides/00_Model/06_SearchFilters.md
+++ b/docs/en/02_Developer_Guides/00_Model/06_SearchFilters.md
@@ -32,11 +32,11 @@ An example of a `SearchFilter` in use:
Developers can define their own [api:SearchFilter] if needing to extend the ORM filter and exclude behaviors.
These suffixes can also take modifiers themselves. The modifiers currently supported are `":not"`, `":nocase"` and
-`":case"`. These negate the filter, make it case-insensitive and make it case-sensitive respectively. The default
+`":case"`. These negate the filter, make it case-insensitive and make it case-sensitive, respectively. The default
comparison uses the database's default. For MySQL and MSSQL, this is case-insensitive. For PostgreSQL, this is
case-sensitive.
-The following is a query which will return everyone whose first name starts with S either lower or uppercase
+The following is a query which will return everyone whose first name starts with "S", either lowercase or uppercase:
:::php
$players = Player::get()->filter(array(
diff --git a/docs/en/02_Developer_Guides/00_Model/10_Versioning.md b/docs/en/02_Developer_Guides/00_Model/10_Versioning.md
index db0b43439..9494b6f73 100644
--- a/docs/en/02_Developer_Guides/00_Model/10_Versioning.md
+++ b/docs/en/02_Developer_Guides/00_Model/10_Versioning.md
@@ -3,7 +3,7 @@ summary: Add versioning to your database content through the Versioned extension
# Versioning
-Database content in SilverStripe can be "staged" before its publication, as well as tracking all changes through the
+Database content in SilverStripe can be "staged" before its publication, as well as track all changes through the
lifetime of a database record.
It is most commonly applied to pages in the CMS (the `SiteTree` class). Draft content edited in the CMS can be different
@@ -148,8 +148,16 @@ helpers.
### Templates Variables
In templates, you don't need to worry about this distinction. The `$Content` variable contain the published content by
-default, and only preview draft content if explicitly requested (e.g. by the "preview" feature in the CMS). If you want
-to force a specific stage, we recommend the `Controller->init()` method for this purpose.
+default, and only preview draft content if explicitly requested (e.g. by the "preview" feature in the CMS, or by adding ?stage=Stage to the URL). If you want
+to force a specific stage, we recommend the `Controller->init()` method for this purpose, for example:
+
+**mysite/code/MyController.php**
+ :::php
+ public function init() {
+ parent::init();
+ Versioned::set_reading_mode('Stage.Stage');
+ }
+
### Controllers
diff --git a/docs/en/02_Developer_Guides/00_Model/11_Scaffolding.md b/docs/en/02_Developer_Guides/00_Model/11_Scaffolding.md
index 2a014169f..3aeddd0f8 100644
--- a/docs/en/02_Developer_Guides/00_Model/11_Scaffolding.md
+++ b/docs/en/02_Developer_Guides/00_Model/11_Scaffolding.md
@@ -1,5 +1,5 @@
title: Building Model and Search Interfaces around Scaffolding
-summary: Model Driven approach to defining your application UI.
+summary: A Model-driven approach to defining your application UI.
# Scaffolding
@@ -24,7 +24,7 @@ An example is `DataObject`, SilverStripe will automatically create your CMS inte
);
public function getCMSFields() {
- // parent::getCMSFields() does all the hard work and creates the fields for title, isactive and content.
+ // parent::getCMSFields() does all the hard work and creates the fields for Title, IsActive and Content.
$fields = parent::getCMSFields();
$fields->fieldByName('IsActive')->setTitle('Is active?');
@@ -32,6 +32,26 @@ An example is `DataObject`, SilverStripe will automatically create your CMS inte
}
}
+To fully customize your form fields, start with an empty FieldList.
+
+ :::php
+ setRows(5)
+ )
+ );
+
+ return $fields;
+ }
+
+
+
You can also alter the fields of built-in and module `DataObject` classes through your own
[DataExtension](../extensions), and a call to `DataExtension->updateCMSFields`.
@@ -125,7 +145,7 @@ To include relations (`$has_one`, `$has_many` and `$many_many`) in your search,
### Summary Fields
-Summary fields can be used to show a quick overview of the data for a specific [api:DataObject] record. Most common use
+Summary fields can be used to show a quick overview of the data for a specific [api:DataObject] record. The most common use
is their display as table columns, e.g. in the search results of a `[api:ModelAdmin]` CMS interface.
:::php