Command/CleanAssetsCommand.php
protected function initialize(InputInterface $input, OutputInterface $output)
    {
        // Check if this command can be launched ?
        $this->resourceManager = $this->getContainer()->get(ResourceManagerInterface::class);
        $this->doctrine = $this->getContainer()->get(ManagerRegistry::class);
        $this->fileSystemRegistry = $this->getContainer()->get(FilesystemRegistry::class);

        foreach ($this->resourceManager->getResourceConfigurations() as $resourceConfiguration) {
            $filesystem = $this->resourceManager->getFilesystemForType($resourceConfiguration->getCode());
            if (!method_exists($filesystem, 'getAdapter')) {
                // This is due to the fact that the Filesystem layer does not differenciate it's own files from other
                // files owned by a different filesystem but with the same adapter
                // In the end if we want to make sure that we don't delete files from an other filesystem using the
                // same adapter we need to get to the adapter
                throw new \UnexpectedValueException('Filesystem must allow access to adapter');
            }
            $adapter = $filesystem->getAdapter();
            $adapterReference = spl_object_hash($adapter);
            $this->adapters[$adapterReference] = $adapter;
            $this->adaptersByResourceType[$resourceConfiguration->getCode()] = $adapterReference;
        }
    }
protected function initialize(InputInterface $input, OutputInterface $output)
    {
        // Check if this command can be launched ?
        $this->resourceManager = $this->getContainer()->get(ResourceManagerInterface::class);
        $this->doctrine = $this->getContainer()->get(ManagerRegistry::class);
        $this->fileSystemRegistry = $this->getContainer()->get(FilesystemRegistry::class);

        foreach ($this->resourceManager->getResourceConfigurations() as $resourceConfiguration) {
            $filesystem = $this->resourceManager->getFilesystemForType($resourceConfiguration->getCode());
            if (!method_exists($filesystem, 'getAdapter')) {
                // This is due to the fact that the Filesystem layer does not differenciate it's own files from other
                // files owned by a different filesystem but with the same adapter
                // In the end if we want to make sure that we don't delete files from an other filesystem using the
                // same adapter we need to get to the adapter
                throw new \UnexpectedValueException('Filesystem must allow access to adapter');
            }
            $adapter = $filesystem->getAdapter();
            $adapterReference = spl_object_hash($adapter);
            $this->adapters[$adapterReference] = $adapter;
            $this->adaptersByResourceType[$resourceConfiguration->getCode()] = $adapterReference;
        }
    }
protected function initialize ( InputInterface $ input , OutputInterface $ output ) { // Check if this command can be launched ? $ this -> resourceManager = $ this -> getContainer ( ) -> get ( ResourceManagerInterface :: class ) ; $ this -> doctrine = $ this -> getContainer ( ) -> get ( ManagerRegistry :: class ) ; $ this -> fileSystemRegistry = $ this -> getContainer ( ) -> get ( FilesystemRegistry :: class ) ; foreach ( $ this -> resourceManager -> getResourceConfigurations ( ) as $ resourceConfiguration ) { $ filesystem = $ this -> resourceManager -> getFilesystemForType ( $ resourceConfiguration -> getCode ( ) ) ; if ( ! method_exists ( $ filesystem , 'getAdapter' ) ) { // This is due to the fact that the Filesystem layer does not differenciate it's own files from other // files owned by a different filesystem but with the same adapter // In the end if we want to make sure that we don't delete files from an other filesystem using the // same adapter we need to get to the adapter throw new \ UnexpectedValueException ( 'Filesystem must allow access to adapter' ) ; } $ adapter = $ filesystem -> getAdapter ( ) ; $ adapterReference = spl_object_hash ( $ adapter ) ; $ this -> adapters [ $ adapterReference ] = $ adapter ; $ this -> adaptersByResourceType [ $ resourceConfiguration -> getCode ( ) ] = $ adapterReference ; } }
@param InputInterface  $input
@param OutputInterface $output

@throws \LogicException
@throws ServiceCircularReferenceException
@throws ServiceNotFoundException
@throws \UnexpectedValueException
@param InputInterface $input @param OutputInterface $output