Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
examples:builder:hasmany_relation [2021/03/27 15:46] pdsci-admin [Step 7: Add the rendering file to the parent form] |
examples:builder:hasmany_relation [2021/04/11 19:06] (current) pdsci-admin [Step 4: Announce the relation to the parent model] |
||
|---|---|---|---|
| Line 84: | Line 84: | ||
| public $implement = [' | public $implement = [' | ||
| ' | ' | ||
| - | ' | + | ' |
| | | ||
| public $listConfig = ' | public $listConfig = ' | ||
| Line 102: | Line 102: | ||
| </ | </ | ||
| \\ | \\ | ||
| - | ===== Step 4: Announce | + | ===== Step 4: Define |
| - | To make the parent model able to work with the relation, the type of the relation, the name of the relation and the child model have to be announced | + | To make the parent model able to work with the relation, the type of the relation, the name of the relation and the child model have to be defined |
| \\ | \\ | ||
| {{: | {{: | ||
| Line 115: | Line 115: | ||
| ... | ... | ||
| - | | + | |
| ' | ' | ||
| ]; | ]; | ||
| Line 123: | Line 123: | ||
| In line 4 the public variable ' | In line 4 the public variable ' | ||
| In line 5 ' | In line 5 ' | ||
| + | By default the key field to look for the records with related IDs will be created by the name of the model trailed by ' | ||
| + | \\ | ||
| Remember each definition for a relation is like a table field. A definition can hold several definitions for different relations. Like so:\\ | Remember each definition for a relation is like a table field. A definition can hold several definitions for different relations. Like so:\\ | ||
| <sxh php; highlight: [5-9]> | <sxh php; highlight: [5-9]> | ||
| Line 191: | Line 193: | ||
| label: Reviews | label: Reviews | ||
| view: | view: | ||
| - | | + | |
| toolbarButtons: | toolbarButtons: | ||
| manage: | manage: | ||
| form: $/ | form: $/ | ||
| - | | + | |
| ... | ... | ||
| </ | </ | ||
| Line 240: | Line 241: | ||
| Notice the ' | Notice the ' | ||
| \\ | \\ | ||
| - | {{: | + | {{: |
| <WRAP clear /> | <WRAP clear /> | ||
| \\ | \\ | ||
| Now the form is ready to create, show, edit, delete, link and unlink a record from the child table within/to a record of the parent table. | Now the form is ready to create, show, edit, delete, link and unlink a record from the child table within/to a record of the parent table. | ||
| ---- | ---- | ||