| @@ 130-143 (lines=14) @@ | ||
| 127 | } |
|
| 128 | } |
|
| 129 | ||
| 130 | public function numberOfRelationsToEntity(string $entityToReach) |
|
| 131 | { |
|
| 132 | $numberOfRelationsToEntity = 0; |
|
| 133 | ||
| 134 | foreach ($this->map as $rootEntity => $meta) { |
|
| 135 | foreach ($meta['relations'] as $name => $entity) { |
|
| 136 | if ($entity == $entityToReach) { |
|
| 137 | $numberOfRelationsToEntity++; |
|
| 138 | } |
|
| 139 | } |
|
| 140 | } |
|
| 141 | ||
| 142 | return $numberOfRelationsToEntity; |
|
| 143 | } |
|
| 144 | ||
| 145 | public function listOfParentsOf(string $entityToReach) |
|
| 146 | { |
|
| @@ 145-158 (lines=14) @@ | ||
| 142 | return $numberOfRelationsToEntity; |
|
| 143 | } |
|
| 144 | ||
| 145 | public function listOfParentsOf(string $entityToReach) |
|
| 146 | { |
|
| 147 | $parents = []; |
|
| 148 | ||
| 149 | foreach ($this->map as $rootEntity => $meta) { |
|
| 150 | foreach ($meta['relations'] as $name => $entity) { |
|
| 151 | if ($entity == $entityToReach) { |
|
| 152 | $parents[] = $rootEntity; |
|
| 153 | } |
|
| 154 | } |
|
| 155 | } |
|
| 156 | ||
| 157 | return $parents; |
|
| 158 | } |
|
| 159 | ||
| 160 | public function getEntitiesPath() |
|
| 161 | { |
|