当前位置: 首页>>代码示例>>PHP>>正文


PHP self::recordThat方法代码示例

本文整理汇总了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;
 }
开发者ID:novuso,项目名称:common-l,代码行数:7,代码来源:Document.php

示例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;
 }
开发者ID:franiglesias,项目名称:milhojas,代码行数:7,代码来源:Post.php

示例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;
 }
开发者ID:renereed1,项目名称:proophessor-do,代码行数:13,代码来源:User.php

示例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;
 }
开发者ID:creativeprogramming,项目名称:event-sourcing,代码行数:7,代码来源:BrokenUser.php

示例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;
 }
开发者ID:basz,项目名称:proophessor-do,代码行数:13,代码来源:Todo.php

示例6: register

 public static function register($name)
 {
     $id = PersonId::generate();
     $person = new self($id, $name);
     $person->recordThat(new PersonRegistered($id, $name));
     return $person;
 }
开发者ID:novuso,项目名称:common-l,代码行数:7,代码来源:Person.php

示例7: create

 public static function create($description)
 {
     $id = TaskId::generate();
     $task = new self($id, $description);
     $task->recordThat(new TaskCreatedEvent($id, $description));
     return $task;
 }
开发者ID:novuso,项目名称:common-l,代码行数:7,代码来源:Task.php

示例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;
 }
开发者ID:novuso,项目名称:common-l,代码行数:8,代码来源:Menu.php

示例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;
 }
开发者ID:prooph,项目名称:link-app-core,代码行数:14,代码来源:EventStoreConfig.php

示例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;
 }
开发者ID:prooph,项目名称:event-sourcing,代码行数:18,代码来源:quickstart.php

示例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;
 }
开发者ID:prooph,项目名称:link-app-core,代码行数:15,代码来源:ProcessingConfig.php

示例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;
 }
开发者ID:bweston92,项目名称:done,代码行数:21,代码来源:Story.php

示例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;
 }
开发者ID:prooph,项目名称:link-process-manager,代码行数:13,代码来源:Task.php

示例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;
 }
开发者ID:prooph,项目名称:link-process-manager,代码行数:14,代码来源:Workflow.php

示例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;
 }
开发者ID:creativeprogramming,项目名称:event-store,代码行数:11,代码来源:User.php


注:本文中的self::recordThat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。