Skip to content

Instantly share code, notes, and snippets.

@JavierCane
Created November 20, 2016 12:35
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 JavierCane/2aa4267e1de1e38176f77b1cf2cd9a67 to your computer and use it in GitHub Desktop.
Save JavierCane/2aa4267e1de1e38176f77b1cf2cd9a67 to your computer and use it in GitHub Desktop.
<?php
namespace CodelyTv\Api\Controller;
use CodelyTv\Context\Meetup\Module\Video\Domain\Create\CreateVideoCommand;
use CodelyTv\Infrastructure\Bus\Command\CommandBus;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
final class VideoController extends Controller
{
private $bus;
public function __construct(CommandBus $bus)
{
$this->bus = $bus;
}
public function createAction(string $id, Request $request)
{
$command = new CreateVideoCommand(
$id,
$request->get('title'),
$request->get('url'),
$request->get('course_id')
);
$this->bus->dispatch($command);
return new Response('', Response::HTTP_CREATED);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment