本文整理汇总了PHP中self::recordThat方法的典型用法代码示例。如果您正苦于以下问题:PHP self::recordThat方法的具体用法?PHP self::recordThat怎么用?PHP self::recordThat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::recordThat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public static function create()
{
$id = DocumentId::generate();
$document = new self($id);
$document->recordThat(new DocumentCreated($id));
return $document;
}
示例2: write
public static function write(PostId $id, PostContent $content, $author = '')
{
$post = new self();
$post->id = $id;
$post->recordThat(new Events\NewPostWasWritten($id->getId(), $content->getTitle(), $content->getBody(), $author));
return $post;
}
示例3: registerWithData
/**
* @param UserId $userId
* @param string $name
* @param EmailAddress $emailAddress
* @return User
*/
public static function registerWithData(UserId $userId, $name, EmailAddress $emailAddress)
{
$self = new self();
$self->assertName($name);
$self->recordThat(UserWasRegistered::withData($userId, $name, $emailAddress));
return $self;
}
示例4: nameNew
public static function nameNew($name)
{
$id = Uuid::uuid4()->toString();
$instance = new self();
$instance->recordThat(UserCreated::occur($id, ['id' => $id, 'name' => $name]));
return $instance;
}
示例5: post
/**
* @param string $text
* @param UserId $assigneeId
* @param TodoId $todoId
* @return Todo
*/
public static function post($text, UserId $assigneeId, TodoId $todoId)
{
$self = new self();
$self->assertText($text);
$self->recordThat(TodoWasPosted::byUser($assigneeId, $text, $todoId, TodoStatus::open()));
return $self;
}
示例6: register
public static function register($name)
{
$id = PersonId::generate();
$person = new self($id, $name);
$person->recordThat(new PersonRegistered($id, $name));
return $person;
}
示例7: create
public static function create($description)
{
$id = TaskId::generate();
$task = new self($id, $description);
$task->recordThat(new TaskCreatedEvent($id, $description));
return $task;
}
示例8: create
public static function create($name)
{
$id = MenuId::generate();
$name = MenuName::fromString($name);
$menu = new self($id);
$menu->recordThat(new MenuCreated($id, $name));
return $menu;
}
示例9: initializeWithSqliteDb
/**
* @param SqliteDbFile $sqliteDbFile
* @param ConfigLocation $configLocation
* @param ConfigWriter $configWriter
* @return EventStoreConfig
*/
public static function initializeWithSqliteDb(SqliteDbFile $sqliteDbFile, ConfigLocation $configLocation, ConfigWriter $configWriter)
{
$config = ['proophessor' => ['event_store' => ['adapter' => ['type' => 'Prooph\\EventStore\\Adapter\\Doctrine\\DoctrineEventStoreAdapter', 'options' => ['connection' => ['driver' => 'pdo_sqlite', 'path' => $sqliteDbFile->toString()], 'serializer_adapter' => 'json']]]]];
$instance = new self($config, $configLocation);
$configWriter->writeNewConfigToDirectory($config, $configLocation->toString() . DIRECTORY_SEPARATOR . $instance->configFileName());
$instance->recordThat(EventStoreWasInitialized::withSqliteDb($sqliteDbFile, $configLocation, $instance->configFileName()));
return $instance;
}
示例10: nameNew
/**
* ARs should be created via static factory methods
*
* @param string $username
* @return User
*/
public static function nameNew($username)
{
//Perform assertions before raising a event
\Assert\that($username)->notEmpty()->string();
$uuid = Uuid::uuid4();
//AggregateRoot::__construct is defined as protected so it can be called in a static factory of
//an extending class
$instance = new self();
//Use AggregateRoot::recordThat method to apply a new Event
$instance->recordThat(UserWasCreated::occur($uuid->toString(), ['name' => $username]));
return $instance;
}
示例11: initializeWithDefaultsIn
/**
* Uses Prooph\Processing\Environment to initialize with its defaults
*/
public static function initializeWithDefaultsIn(ConfigLocation $configLocation, ConfigWriter $configWriter)
{
$env = Environment::setUp();
$instance = new self(['processing' => array_merge($env->getConfig()->toArray(), ["connectors" => [], "js_ticker" => ['enabled' => false, 'interval' => 3]])], $configLocation);
$configFilePath = $configLocation->toString() . DIRECTORY_SEPARATOR . self::$configFileName;
if (file_exists($configFilePath)) {
throw new \RuntimeException("Processing config already exists: " . $configFilePath);
}
$configWriter->writeNewConfigToDirectory($instance->toArray(), $configFilePath);
$instance->recordThat(ProcessingConfigFileWasCreated::in($configLocation, self::$configFileName));
return $instance;
}
示例12: start
/**
* @param StoryName $storyName
* @param Message $startMessage
* @param ChapterTemplate[] $chapterTemplates
* @param MessageConverter $messageConverter
* @throws Exception\Story
* @return Story
*/
public static function start(StoryName $storyName, Message $startMessage, array $chapterTemplates, MessageConverter $messageConverter)
{
self::assertChapterTemplates($chapterTemplates, $storyName);
$storyId = StoryId::fromString($startMessage->uuid()->toString());
$self = new self();
$self->recordThat(StoryWasStarted::withStoryIdAndName($storyId, $storyName));
$nextCommands = $self->startNextChapters($storyName, $startMessage, $chapterTemplates, $storyId, $messageConverter);
if (empty($nextCommands)) {
throw Exception\Story::cannotBeStartedForMessage($startMessage);
}
$self->nextCommands = $nextCommands;
return $self;
}
示例13: setUp
/**
* @param MessageHandler $messageHandler
* @param TaskType $taskType
* @param Prototype $processingType
* @param ProcessingMetadata $metadata
* @return Task
*/
public static function setUp(MessageHandler $messageHandler, TaskType $taskType, Prototype $processingType, ProcessingMetadata $metadata)
{
$instance = new self();
$instance->recordThat(TaskWasSetUp::with(TaskId::generate(), $taskType, $messageHandler, $processingType, $metadata));
return $instance;
}
示例14: locatedOn
/**
* @param NodeName $nodeName
* @param WorkflowId $workflowId
* @param string $workflowName
* @return Workflow
*/
public static function locatedOn(NodeName $nodeName, WorkflowId $workflowId, $workflowName)
{
Assertion::string($workflowName);
Assertion::notEmpty($workflowName);
$instance = new self();
$instance->recordThat(WorkflowWasCreated::on($nodeName, $workflowId, $workflowName));
return $instance;
}
示例15: create
/**
* @param string $name
* @param string $email
* @return User
*/
public static function create($name, $email)
{
$self = new self();
$self->recordThat(UserCreated::with(['user_id' => Uuid::uuid4()->toString(), 'name' => $name, 'email' => $email], $self->nextVersion()));
return $self;
}