ClearMetadataCacheDoctrineCommand.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
  3. use Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand;
  4. use Symfony\Component\Console\Input\InputInterface;
  5. use Symfony\Component\Console\Input\InputOption;
  6. use Symfony\Component\Console\Output\OutputInterface;
  7. use function sprintf;
  8. use function trigger_error;
  9. use const E_USER_DEPRECATED;
  10. /**
  11. * Command to clear the metadata cache of the various cache drivers.
  12. *
  13. * @deprecated
  14. */
  15. class ClearMetadataCacheDoctrineCommand extends MetadataCommand
  16. {
  17. /**
  18. * {@inheritDoc}
  19. */
  20. protected function configure()
  21. {
  22. parent::configure();
  23. $this
  24. ->setName('doctrine:cache:clear-metadata')
  25. ->setDescription('Clears all metadata cache for an entity manager')
  26. ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
  27. }
  28. /**
  29. * {@inheritDoc}
  30. */
  31. protected function execute(InputInterface $input, OutputInterface $output)
  32. {
  33. @trigger_error(sprintf('The "%s" (doctrine:cache:clear-metadata) is deprecated, metadata cache now uses PHP Array cache which can not be cleared.', self::class), E_USER_DEPRECATED);
  34. DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
  35. return parent::execute($input, $output);
  36. }
  37. }