Permalink
Browse files

After the break!

  • Loading branch information...
simensen committed Jun 25, 2015
1 parent c14d25c commit d7698f2bc5fff810a0b48be87af9627738dbe92d
@@ -2,7 +2,9 @@
namespace SuperAwesome\Blog\Domain\Model\Post\Event;
class PostWasCategorized
use Broadway\Serializer\SerializableInterface;
class PostWasCategorized implements SerializableInterface
{
/**
* @var string
@@ -2,7 +2,9 @@
namespace SuperAwesome\Blog\Domain\Model\Post\Event;
class PostWasCreated
use Broadway\Serializer\SerializableInterface;
class PostWasCreated implements SerializableInterface
{
/**
* @var string
@@ -2,7 +2,9 @@
namespace SuperAwesome\Blog\Domain\Model\Post\Event;
class PostWasPublished
use Broadway\Serializer\SerializableInterface;
class PostWasPublished implements SerializableInterface
{
/**
* @var string
@@ -2,7 +2,9 @@
namespace SuperAwesome\Blog\Domain\Model\Post\Event;
class PostWasTagged
use Broadway\Serializer\SerializableInterface;
class PostWasTagged implements SerializableInterface
{
/**
* @var string
@@ -2,7 +2,9 @@
namespace SuperAwesome\Blog\Domain\Model\Post\Event;
class PostWasUncategorized
use Broadway\Serializer\SerializableInterface;
class PostWasUncategorized implements SerializableInterface
{
/**
* @var string
@@ -2,7 +2,9 @@
namespace SuperAwesome\Blog\Domain\Model\Post\Event;
class PostWasUntagged
use Broadway\Serializer\SerializableInterface;
class PostWasUntagged implements SerializableInterface
{
/**
* @var string
@@ -2,9 +2,10 @@
namespace SuperAwesome\Blog\Domain\ReadModel\PostTagCount;
use Broadway\ReadModel\ReadModelInterface;
use Broadway\Serializer\SerializableInterface;
class PostTagCount implements SerializableInterface
class PostTagCount implements ReadModelInterface, SerializableInterface
{
/**
* @var string
@@ -76,4 +77,9 @@ public function serialize()
'count' => $this->count,
];
}
public function getId()
{
return $this->tag;
}
}
@@ -0,0 +1,31 @@
<?php
namespace SuperAwesome\Symfony\BlogBundle\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class RebuildPostCountProjectorCommand extends CommandBusCommand
{
protected function configure()
{
$this->setName('superawesome:blog:post:replay-post-tags');
$this->setDescription('Replay the PostTag ReadModel');
$this->setDefinition([
new InputArgument('id', InputArgument::REQUIRED, 'ID for the Post to be replayed'),
]);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$id = $input->getArgument('id');
$eventStore = $this->getContainer()->get('broadway.event_store');
$eventStream = $eventStore->load($id);
$tagProjector = $this->getContainer()->get(
'superawesome.blog.domain.read_model.post_tag_count.projector.broadway'
);
foreach ($eventStream as $event) {
$tagProjector->handle($event);
}
}
}
@@ -2,6 +2,7 @@
namespace SuperAwesome\Symfony\BlogBundle\Command;
use SuperAwesome\Blog\Domain\Model\Post\Command\UntagPost;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -24,6 +25,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$id = $input->getArgument('id');
$tag = $input->getArgument('tag');
// @TODO Implement
$command = new UntagPost($id, $tag);
$this->getCommandBus()->dispatch($command);
}
}

0 comments on commit d7698f2

Please sign in to comment.