FAQ Database Discussion Community


Is it possible to move the console “Command” folder from it's default directory and avoiding the Exception: Command “name” is not defined?

symfony2,console,symfony-console
By default the console command folder is in: MyProject\MyBundle\Command and all works as expected, but if I move the folder in another directory like :MyProject\MyBundle\MyFolder\Command on command execution it thrown an: [InvalidArgumentException] Command "command_name" is not defined. I haven't been able to find anything useful after searching over the internet...

is it bad practice to kill a script inside of a function?

php,symfony2,symfony-console
I'm referring to using the die() function for something else than debugging. This is a "well it works" situation, but is it bad practice? use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Exception\IOExceptionInterface; /** * This Command will help Cjw create a new demo site to start off * with the Multisite bundle. * *...

Doctrine standalone without cli-config.php

php,doctrine2,symfony-components,symfony-console
I want to integrate Doctrine ORM into my (non-Symfony) project. I already done this in another project and used the famous cli-config.php into the project root directory. But now, in my new project, I use the Symfony Console component and the Dependency Injection component (to reference services and commands, by...

I got an error on symfony/console — “Option does not exits”. How can I allow any options even without setting it out?

symfony2,symfony-console
Is it possible in symfony/console to allow all options or argument even if it didn't set on config? You see, based from the following example. It has ->addArgument() and ->addOption(), it sets name and yell param and option respectively. http://symfony.com/doc/current/components/console/introduction.html class GreetCommand extends Command { protected function configure() { $this...

How to create a console command in Symfony2 application

php,symfony2,symfony-2.6,symfony-components,symfony-console
I need to create a console command for a Symfony2 application and I read docs here and here though I am not sure what of those I should follow. So this is what I did. Create a file under /src/PDI/PDOneBundle/Console/PDOneSyncCommand.php Write this code: namespace PDI\PDOneBundle\Console\Command; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use...

Start a background symfony/process from symfony/console

php,symfony2,symfony-console
I'm attempting to create a cli (symfony/console) that manages long-running child processes (symfony/process) that consume a message queue. I have two commands, Consume and Listen. Consume is a wrapper for Listen so it can be run in the background. Listen is a long running dump of the MQ that shows...