code: private function getComposedEntities(array $entities)
      {
          foreach ($entities as $className => $entity) {
              if (array_key_exists('extends', $entity)) {
                  $this->assertParentClassNameExists($entity['extends'], $entities);
                  $this->assertParentClassHasIdField($entity['extends'], $entities);
  
                  yield $className => [
                      'id' => $entities[$entity['extends']]['id'],
                      'extends' => $entity['extends'],
                      'relations' => array_merge(
                          $entities[$entity['extends']]['relations'],
                          $entity['relations']
                      )
                  ];
              } else {
                  yield $className => [
                      'id' => $entity['id'],
                      'extends' => $className,
                      'relations' => $entity['relations']
                  ];
              }
          }
      }
docs: @param array $entities
  
  @return \Generator
  
  @throw \RuntimeException