1 | <?php |
||
7 | class Relationships { |
||
8 | |||
9 | /** @var Map */ |
||
10 | private $all; |
||
11 | |||
12 | /** @var Map */ |
||
13 | private $oneToOne; |
||
14 | |||
15 | /** @var Map */ |
||
16 | private $oneToMany; |
||
17 | |||
18 | /** @var Map */ |
||
19 | private $manyToMany; |
||
20 | |||
21 | /** @var Table */ |
||
22 | private $model; |
||
23 | |||
24 | public function __construct(Table $model) { |
||
31 | |||
32 | /** |
||
33 | * @return Table |
||
34 | */ |
||
35 | public function getModel() { |
||
38 | |||
39 | /** |
||
40 | * Adds a relationships to this collection |
||
41 | * |
||
42 | * @param Relationship $relationship |
||
43 | */ |
||
44 | public function add(Relationship $relationship) { |
||
61 | |||
62 | /** |
||
63 | * Return all relationships |
||
64 | * |
||
65 | * @return Map |
||
66 | */ |
||
67 | public function getAll() { |
||
70 | |||
71 | /** |
||
72 | * Return one-to-one relationships |
||
73 | * |
||
74 | * @return Map |
||
75 | */ |
||
76 | public function getOneToOne() { |
||
79 | |||
80 | /** |
||
81 | * Return one-to-many relationships |
||
82 | * |
||
83 | * @return Map |
||
84 | */ |
||
85 | public function getOneToMany() { |
||
88 | |||
89 | /** |
||
90 | * Return many-to-many relationships |
||
91 | * |
||
92 | * @return Map |
||
93 | */ |
||
94 | public function getManyToMany() { |
||
97 | |||
98 | /** |
||
99 | * The number of all relationships |
||
100 | * |
||
101 | * @return int |
||
102 | */ |
||
103 | public function size() { |
||
106 | |||
107 | /** |
||
108 | * Checks whether a relationship with the given related type name exists |
||
109 | * |
||
110 | * @param string $relatedTypeName |
||
111 | * @return boolean |
||
112 | */ |
||
113 | public function has($relatedTypeName) { |
||
116 | |||
117 | /** |
||
118 | * Returns a relationship with the given related type name |
||
119 | * |
||
120 | * @param string $relatedTypeName |
||
121 | * @return Relationship |
||
122 | */ |
||
123 | public function get($relatedTypeName) { |
||
126 | } |