Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 12 |
| OrderRepository | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
72 | |
0.00% |
0 / 12 |
| __construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 5 |
|||
| save | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| get | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 4 |
|||
| findByCriteria | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
| <?php | |
| declare(strict_types=1); | |
| namespace App\Order\Infrastructure\Persistence\Repository; | |
| use App\Order\Domain\Model\Order; | |
| use App\Order\Domain\ValueObject\OrderId; | |
| use Prooph\EventSourcing\Aggregate\AggregateRepository; | |
| use Prooph\EventSourcing\Aggregate\AggregateType; | |
| use Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator; | |
| use Prooph\EventStore\EventStore; | |
| use RuntimeException; | |
| final class OrderRepository extends AggregateRepository implements OrderRepositoryInterface | |
| { | |
| public function __construct(EventStore $eventStore) | |
| { | |
| parent::__construct( | |
| $eventStore, | |
| AggregateType::fromAggregateRootClass(Order::class), | |
| new AggregateTranslator(), | |
| ); | |
| } | |
| public function save(Order $order): void | |
| { | |
| $this->saveAggregateRoot($order); | |
| } | |
| public function get(OrderId $orderId): ?Order | |
| { | |
| $order = $this->getAggregateRoot($orderId->toString()); | |
| if (null !== $order && !$order instanceof Order) { | |
| throw new RuntimeException(sprintf('Object returned by AggregateRepository %s is not an instance of Order', get_class($order))); | |
| } | |
| return $order; | |
| } | |
| public function findByCriteria(array $criteria): ?array | |
| { | |
| return []; | |
| } | |
| } |