Skip to content

Instantly share code, notes, and snippets.

@jverdeyen
Last active February 21, 2018 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jverdeyen/210380146810c1a96c0c64f315b3716f to your computer and use it in GitHub Desktop.
Save jverdeyen/210380146810c1a96c0c64f315b3716f to your computer and use it in GitHub Desktop.
Enqueue Symfony Console commands [QueueController.php]
<?php
namespace AppBundle\Controller;
use AppBundle\Model\Queue\QueuedCommand;
use AppBundle\Service\Queue\QueuedCommandHandler;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
class QueueController extends Controller
{
/**
* @Route("/enqueue")
*/
public function addCommandsAction(QueuedCommandHandler $handler)
{
$command = new QueuedCommand('cache:clear', ['--no-warmup']);
$handler->handle($command);
return new Response('OK');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment