Last active
February 21, 2018 15:31
-
-
Save jverdeyen/210380146810c1a96c0c64f315b3716f to your computer and use it in GitHub Desktop.
Enqueue Symfony Console commands [QueueController.php]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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