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