JMSDiExtraBundle icon indicating copy to clipboard operation
JMSDiExtraBundle copied to clipboard

Possible issue with caching?

Open yellow1912 opened this issue 8 years ago • 0 comments

https://github.com/symfony/symfony/issues/15574

Hello,

I have a use case where I need to be able to run console commands one-by-one consecutively

I created a command to wrap around all the ones I want to run which basically look like this:

foreach ($migrations as $version => $migration) {
            $migration = is_string($migration) ? $migrations[$migration] : $migration;

            foreach ($migration['up'] as $key => $cmd) {
                $stdout->writeln($key);

                $command = $this->getApplication()->find($cmd['command']);

                if (!isset($cmd['args'])) {
                    $cmd['args'] = [];
                }

                array_unshift($cmd['args'], $cmd['command']);

                // use the env of the current command
                $cmd['args']['-e'] = $env;

                $input = new ArrayInput($cmd['args']);

                $returnCode = $command->run($input, $stdout);
            }
        }

Everything works fine except that if I run cache clear as one of the commands, then I will get an error like this for the next command:

PHP Warning:  Uncaught exception 'Symfony\Component\Debug\Exception\ContextErrorException' with message 'Warning: require_once(/path/cache/dev/jms_diextra/doctrine/EntityManager_55d28bc3d8469.php): failed to open stream: No such file or directory' in /path/cache/dev/appDevDebugProjectContainer.php:2231

It seems like that even right after the cache clear I ran cache warmup, then new generated configs/files are not "registered" yet thus causing the issue. I wonder if there is any way to force SF to reload these?

yellow1912 avatar Aug 18 '15 04:08 yellow1912