<commit_before><commit_msg>[+] Command to move museum images<commit_after><?php

namespace Armd\AtlasBundle\Command\Temp;

use Doctrine\Bundle\DoctrineBundle\Command\DoctrineCommand;
use Armd\AtlasBundle\Entity\Object;
use Armd\MuseumBundle\Entity\Museum;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;

class MoveVirtualTourImagesCommand extends DoctrineCommand
{
    protected $em;

    protected function configure()
    {

        $this
            ->setName('armd-mk:atlas:move-virtual-tour-images')
            ->setDescription('')
            ->setHelp(
            <<<EOT
EOT
        );
    }

    /**
     * {@inheritDoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $em = $this->getEntityManager('default');

        $mediaPool = $this->getContainer()->get('sonata.media.pool');
        $museums = $em->getRepository('ArmdMuseumBundle:Museum')->findAll();
        foreach ($museums as $museum) {
            /** @var $image \Application\Sonata\MediaBundle\Entity\Media */
            $image = $museum->getImage();
            if($image instanceof \Application\Sonata\MediaBundle\Entity\Media) {
                $provider = $mediaPool->getProvider($image->getProviderName());
                $path = $provider->getReferenceImage($image);
                if(!$provider->getFilesystem()->has($path)) {
                    $output->writeln('Exists ' . $path);
                } else {
                    $output->writeln('Not exists ' . $path);

                }
            }
        }
    }


}
{'fraction_non_alphanumeric': 0.13897467572575664, 'fraction_numerical': 0.0, 'mean_word_length': 2.3609958506224067, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6614825', 'n_tokens_mistral': 465, 'n_tokens_neox': 447, 'n_words': 69}