protected function getAllEntities()
    {
        $allMeta = $this
            ->getContainer()
            ->get('doctrine')
            ->getManager()
            ->getMetadataFactory()
            ->getAllMetadata();

        /** @var \Doctrine\ORM\Mapping\ClassMetadata $meta */
        foreach ($allMeta as $meta) {
            if (!$meta->isMappedSuperclass && empty($meta->subClasses)) {
                yield $meta->getName();
            }
        }
    }