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; ...
Get Mastering Symfony now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.