1 | <?php |
||
21 | trait TableRelations |
||
22 | { |
||
23 | /** |
||
24 | * Setup relation "one to one" or "one to many" |
||
25 | * |
||
26 | * @param string $key |
||
27 | * @param string $model |
||
28 | * @param string $foreign |
||
29 | * |
||
30 | * @return void |
||
31 | */ |
||
32 | public function linkTo($key, $model, $foreign) : void |
||
36 | |||
37 | /** |
||
38 | * Setup relation "many to many" |
||
39 | * [table1-key] [table1_key-table2-table3_key] [table3-key] |
||
40 | * |
||
41 | * @param string $model |
||
42 | * @param string $link |
||
43 | * |
||
44 | * @return void |
||
45 | */ |
||
46 | public function linkToMany($model, $link) : void |
||
50 | } |
||
51 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: