Creating commands for tasks
One way to create tasks in our project is to log in, push the add new task
button, and fill in the entries here. Wouldn't it be nice if we could do the same from the command line? If we are allowed to see the command line for a live project, this means that we don't need to deal with the hassle of authentication and authorization. So we can get to the point quickly.
To begin with, create a new Command
folder in AppBundle and add the following class to it:
File source: // src/AppBundle/Command/TaskCommand.php
namespace CoreBundle\Command; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; class TaskCommand extends ContainerAwareCommand { protected function configure() { } protected function execute( InputInterface ...