Skip to content
Advertisement

Symfony Command stores an empty SQL-File for Database Backup

i have an issue by making backup from database (Postgresql 11) with Symfony(6.01) Command. I use also for that the Process Bundle of Symfony.

Problem is, if the Controller Action calls the command to backup the database, it saves finally an empty SQL-File. There is also no errors in dev.log or Postgreql logfile.

But when i print out the command to the browser and execute this in the terminal the SQL-File is filled correctly and not empty.

Any Idea what could be the problem. Thanks in advise. PS: I can not use shell script. Didn’t got it better here with CodeFormatting of the command class.

JavaScript

namespace AppXXXXXXYYYYYYBundleCommand;

use SymfonyComponentConsoleAttributeAsCommand;

use SymfonyComponentConsoleCommandCommand;

use SymfonyComponentConsoleInputInputArgument;

use SymfonyComponentConsoleInputInputInterface;

use SymfonyComponentConsoleOutputOutputInterface;

use SymfonyComponentHttpKernelKernelInterface;

use SymfonyComponentProcessProcess;

#[AsCommand( name: ‘xxxxx:dump-database’, description: ‘Creates a xxxxx database dump.’, aliases: [‘xxxxx:dump-database’], hidden: false, )]

class DatabaseDumpCommand extends Command {

JavaScript

/** * @param string $databaseHost

JavaScript

}

Advertisement

Answer

This has worked after the $sqlQuery was written in the CommandClass by this way:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement