Command/CleanAssetsCommand.php
protected function executeDeleteOrphans(InputInterface $input, OutputInterface $output)
    {
        foreach ($this->resourceManager->getResourceConfigurations() as $resourceConfiguration) {
            $className = $resourceConfiguration->getEntity();
            $entityManager = $this->doctrine->getManagerForClass($className);
            if (!$entityManager instanceof EntityManagerInterface) {
                throw new \UnexpectedValueException("No manager found for class {$className}");
            }

            $foundEntities = $this->findAssociatedEntities($entityManager, $className);

            $this->removeOrphanEntities($input, $output, $entityManager, $resourceConfiguration, $foundEntities);
        }
    }
protected function executeDeleteOrphans(InputInterface $input, OutputInterface $output)
    {
        foreach ($this->resourceManager->getResourceConfigurations() as $resourceConfiguration) {
            $className = $resourceConfiguration->getEntity();
            $entityManager = $this->doctrine->getManagerForClass($className);
            if (!$entityManager instanceof EntityManagerInterface) {
                throw new \UnexpectedValueException("No manager found for class {$className}");
            }

            $foundEntities = $this->findAssociatedEntities($entityManager, $className);

            $this->removeOrphanEntities($input, $output, $entityManager, $resourceConfiguration, $foundEntities);
        }
    }
@param InputInterface  $input
@param OutputInterface $output

@throws \UnexpectedValueException
@throws \Symfony\Component\Console\Exception\RuntimeException
@throws \InvalidArgumentException
@throws \BadMethodCallException
@throws \Symfony\Component\Console\Exception\LogicException
@throws \Symfony\Component\Console\Exception\InvalidArgumentException
@throws \Doctrine\ORM\Mapping\MappingException
@throws \RuntimeException