The AggregateRepository is the main interface used to persist and find aggregates.
Usage
<?phpuseSonsOfPHP\Component\EventSourcing\Aggregate\Repository\AggregateRepository;useSonsOfPHP\Component\EventSourcing\Aggregate\AggregateIdInterface;useSonsOfPHP\Component\EventSourcing\Aggregate\AggregateInterface;useSonsOfPHP\Component\EventSourcing\Message\Repository\MessageRepositoryInterface;usePsr\EventDispatcher\EventDispatcherInterface;$repository =newAggregateRepository( $aggregateClass,// @var string $eventDispatcher,// @var EventDispatcherInterface $messageRepository // @var MessageRepositoryInterface);// @var AggregateIdInterface $aggregateId// @var AggregateInterface|null $aggregate$aggregate = $repository->find($aggregateId);// You can also pass in a string as the $aggregateId$aggregate = $repository->find('unique-id');// To save an aggregate$repository->persist($aggregate);