1 | <?php |
||
9 | class HasManyRelationship |
||
10 | { |
||
11 | /** |
||
12 | * @var ElasticsearchModel |
||
13 | */ |
||
14 | protected $parent; |
||
15 | |||
16 | /** |
||
17 | * @var ElasticsearchModel |
||
18 | */ |
||
19 | protected $childClassName; |
||
20 | |||
21 | function __construct(ElasticsearchModel $parent, $childClassName) |
||
26 | |||
27 | /** |
||
28 | * Find all children. |
||
29 | * |
||
30 | * @return ElasticsearchModel[] |
||
31 | */ |
||
32 | public function get() |
||
39 | |||
40 | /** |
||
41 | * Find document by id. |
||
42 | * |
||
43 | * @param mixed $id |
||
44 | * @return ElasticsearchModel |
||
45 | */ |
||
46 | public function find($id) |
||
55 | |||
56 | /** |
||
57 | * Save children. |
||
58 | * |
||
59 | * @param ElasticsearchModel|ElasticsearchModel[] $child |
||
60 | */ |
||
61 | public function save($child) |
||
71 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.