Run symfony action from console

I have two action in my symfony 2 controller. CrawlerBundle:Index:index, CrawlerBundle:Index:update. I need run index action from console. How can I? I think it starts with php app\console ...

Help me please.

Answers


Move the stuff you do in those actions to a service and call it from both your controller and the custom command you'll create.


Use PhaxBundle.

By only declaring a controller as a service, you are able to call your actions with :

$ php app/console phax:action controller action -p param1:value1 -p param2:value2

There is an example with a cron to delete old comments:

$ php app/console phax:action comment deleteOldComments -p date:2013-06-05
Old comments have been deleted: 18
$

Need Your Help

Which function is called when iPhone app is terminated?

iphone xcode ios5

I'm working on a project in Xcode version 4.2.1 and in iOS 5.0. I'm wondering which function will be called when you completely terminate an application, which means even the time when an users for...

LookupError: No installed app with label 'user'

python django

I am receiving LookupError: No installed app with label 'user' when running the following code: