Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC Document scaffolding formfields for model relations #527

Conversation

@@ -83,6 +83,91 @@ You can also alter the fields of built-in and module `DataObject` classes by imp
> [!NOTE]
> `FormField` scaffolding takes [`$field_labels` config](#field-labels) into account as well.

## Scaffolding for relations

Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations. These have sensible default implementations, but you can customise what form field will be used for any given `DataObject` model.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations. These have sensible default implementations, but you can customise what form field will be used for any given `DataObject` model.
Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations. These have sensible default implementations, and you can also customise what form field will be used for any given `DataObject` model.

"but" kind of negates what is said before it, though sensible defaults and not something to negate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations. These have sensible default implementations, but you can customise what form field will be used for any given `DataObject` model.

> [!NOTE]
> Polymorphic `has_one` relations do not have scaffolded form fields. Usually these are managed via a `has_many` relation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> Polymorphic `has_one` relations do not have scaffolded form fields. Usually these are managed via a `has_many` relation.
> Polymorphic `has_one` relations do not have scaffolded form fields. Usually these are managed via a `has_many` relation on the other side of the relation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What side is "the other side"? I think this makes it more confusing rather than clearer.
I'll try "which points at the has_one relation" instead and see what you think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opps meant to request changes

@GuySartorelli GuySartorelli force-pushed the pulls/5/scaffolding-model-relations branch from f5767a5 to 22490ba Compare June 6, 2024 00:15
@@ -83,6 +83,91 @@ You can also alter the fields of built-in and module `DataObject` classes by imp
> [!NOTE]
> `FormField` scaffolding takes [`$field_labels` config](#field-labels) into account as well.

## Scaffolding for relations

Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations. These have sensible default implementations, and you can also customise what form field will be used for any given `DataObject` model.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations. These have sensible default implementations, and you can also customise what form field will be used for any given `DataObject` model.
Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations on the form created when editing DataObjects, with the notable exception of the [SiteTree](api:SilverStripe\CMS\Model\SiteTree) edit form. These have sensible default implementations, and you can also customise what form field will be used for any given `DataObject` model.

Copy link
Member Author

@GuySartorelli GuySartorelli Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've put it in the section above this instead, since that isn't something unique to fields scaffolded for relations.

@GuySartorelli GuySartorelli force-pushed the pulls/5/scaffolding-model-relations branch from 22490ba to d2f3867 Compare June 7, 2024 00:11
@emteknetnz emteknetnz merged commit a87b988 into silverstripe:5 Jun 7, 2024
3 checks passed
@emteknetnz emteknetnz deleted the pulls/5/scaffolding-model-relations branch June 7, 2024 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants