As per the documentation on the symfony, i have created the console file in /bin folder
!/usr/bin/env phpdate_default_timezone_set('UTC');
set_time_limit(0);
(@include_once DIR . '/../vendor/autoload.php') || @include_once DIR . '/../../../autoload.php';
use AppBundle\Console\Command\FetchCompetitionCommand; use Symfony\Component\Console\Application;
$app = new Application(); $app->add(new FetchCompetitionCommand()); $app->run();
and then the Command file in the Bundle/Console/Command Folder
<?php
namespace AppBundle\Console\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class FetchCompetitionCommand extends ContainerAwareCommand {
protected function configure()
{
$this
->setName('getCompetition')
->setDescription('Get the Competition Name (AFL,NRL)')
->addArgument(
'name',
InputArgument::OPTIONAL,
'(Which Competition Data are you looking to fetch?)'
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$name = $input->getArgument('name');
$output->writeln($name );
}
}
?>
What next i need to do for configuring the database and access the data from database
Thanks in Advance