<?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');
    }
}