當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。