1 | <?php |
||
7 | class Relationships { |
||
8 | |||
9 | /** @var Map */ |
||
10 | private $all; |
||
11 | |||
12 | /** @var Map */ |
||
13 | private $one; |
||
14 | |||
15 | /** @var Map */ |
||
16 | private $many; |
||
17 | |||
18 | /** @var Table */ |
||
19 | private $model; |
||
20 | |||
21 | public function __construct(Table $model) { |
||
27 | |||
28 | /** |
||
29 | * @return Table |
||
30 | */ |
||
31 | public function getModel() { |
||
34 | |||
35 | /** |
||
36 | * Adds a relationships to this collection |
||
37 | * |
||
38 | * @param Relationship $relationship |
||
39 | */ |
||
40 | public function add(Relationship $relationship) { |
||
49 | |||
50 | /** |
||
51 | * @return Map |
||
52 | */ |
||
53 | public function getAll() { |
||
56 | |||
57 | /** |
||
58 | * @return Map |
||
59 | */ |
||
60 | public function getOne() { |
||
63 | |||
64 | /** |
||
65 | * @return Map |
||
66 | */ |
||
67 | public function getMany() { |
||
70 | |||
71 | /** |
||
72 | * The number of relationships |
||
73 | * |
||
74 | * @return int |
||
75 | */ |
||
76 | public function size() { |
||
79 | |||
80 | /** |
||
81 | * Checks whether a relationship with the given foreign name exists |
||
82 | * |
||
83 | * @param string $foreignName |
||
84 | * @return boolean |
||
85 | */ |
||
86 | public function has($foreignName) { |
||
89 | |||
90 | /** |
||
91 | * Returns a relationship with the given foreign name |
||
92 | * |
||
93 | * @param string $foreignName |
||
94 | * @return Relationship |
||
95 | */ |
||
96 | public function get($foreignName) { |
||
99 | } |