i have one controller which save data in the database i want to run this controller in the crontab. for this I make
class GetApiController extends Controller {
public function getapiAction() {
download xml data..
saved in database used some querybuilder function.....
}
}
now i try to define a console function
class GetApiCommand extends ContainerAwareCommand
{
protected function execute(InputInterface $input, OutputInterface $output)
{
$getapicontroller =new GetApiController();
$getapicontroller->getapiAction();
}
}
Making instance of this getapi controller and try to call that action method there it give me error that
kBundle\Controller\Controller.php on line 291 Fatal Error: Call to a member function has() on null..
i also try to make this controller service and try to call here with the help of
$this->forward('app.get_controller:getapiAction');
they give again error that forward is not recognizeable
Any idea how to solve this issue? Thanks in advance for help....