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