Prooph\EventSourcing\AggregateChanged::occur PHP Method

occur() public static method

public static occur ( string $aggregateId, array $payload = [] ) : static
$aggregateId string
$payload array
return static
    public static function occur($aggregateId, array $payload = [])
    {
        return new static($aggregateId, $payload);
    }

Usage Example

 /**
  * @test
  */
 public function it_can_track_aggregate_version_but_is_immutable()
 {
     $orgEvent = AggregateChanged::occur('1', ['key' => 'value']);
     $newEvent = $orgEvent->withVersion(2);
     $this->assertEquals(0, $orgEvent->version());
     $this->assertEquals(2, $newEvent->version());
 }
All Usage Examples Of Prooph\EventSourcing\AggregateChanged::occur