@@ 95-108 (lines=14) @@ | ||
92 | } |
|
93 | } |
|
94 | ||
95 | public function numberOfRealtionTo(string $entityToReach) |
|
96 | { |
|
97 | $numberOfRealtionTo = 0; |
|
98 | ||
99 | foreach ($this->map as $rootEntity => $meta) { |
|
100 | foreach ($meta['relations'] as $name => $entity) { |
|
101 | if ($entity == $entityToReach) { |
|
102 | $numberOfRealtionTo++; |
|
103 | } |
|
104 | } |
|
105 | } |
|
106 | ||
107 | return $numberOfRealtionTo; |
|
108 | } |
|
109 | ||
110 | public function listOfParentsOf(string $entityToReach) |
|
111 | { |
|
@@ 110-123 (lines=14) @@ | ||
107 | return $numberOfRealtionTo; |
|
108 | } |
|
109 | ||
110 | public function listOfParentsOf(string $entityToReach) |
|
111 | { |
|
112 | $parents = []; |
|
113 | ||
114 | foreach ($this->map as $rootEntity => $meta) { |
|
115 | foreach ($meta['relations'] as $name => $entity) { |
|
116 | if ($entity == $entityToReach) { |
|
117 | $parents[] = $rootEntity; |
|
118 | } |
|
119 | } |
|
120 | } |
|
121 | ||
122 | return $parents; |
|
123 | } |
|
124 | } |
|
125 |