Prooph\EventStore\Aggregate\AggregateType::fromString PHP Method

fromString() public static method

Use this factory when the aggregate type is not equal to the aggregate root class
public static fromString ( $aggregateTypeString ) : AggregateType
$aggregateTypeString
return AggregateType
    public static function fromString($aggregateTypeString)
    {
        return new static($aggregateTypeString);
    }

Usage Example

 /**
  * @test
  */
 public function it_uses_custom_snapshot_grid_fs_map_and_write_concern()
 {
     $this->adapter = new MongoDbAdapter($this->client, 'test', ['w' => 'majority', 'j' => true], ['foo' => 'bar']);
     $aggregateType = AggregateType::fromString('foo');
     $aggregateRoot = new \stdClass();
     $aggregateRoot->foo = 'bar';
     $time = microtime(true);
     if (false === strpos($time, '.')) {
         $time .= '.0000';
     }
     $now = \DateTimeImmutable::createFromFormat('U.u', $time);
     $snapshot = new Snapshot($aggregateType, 'id', $aggregateRoot, 1, $now);
     $this->adapter->add($snapshot);
     $gridFs = $this->client->selectDB('test')->getGridFS('bar');
     $file = $gridFs->findOne();
     $this->assertNotNull($file);
 }
All Usage Examples Of Prooph\EventStore\Aggregate\AggregateType::fromString