Skip to content

Instantly share code, notes, and snippets.

@yourwebmaker
Created October 18, 2018 11:54
Show Gist options
  • Save yourwebmaker/3384e9deed550322f706c1312b64e170 to your computer and use it in GitHub Desktop.
Save yourwebmaker/3384e9deed550322f706c1312b64e170 to your computer and use it in GitHub Desktop.
<?php
namespace OrderExample
{
interface Order
{
public static function create(OrderId $orderId, DateTimeImmutable $orderDate) : Order;
public function addLine(LineNumber $lineId, ProductId $productId, Quantity $quantity) : void;
}
class OrderTalisORM implements Order
{
public static function create(OrderId $orderId, DateTimeImmutable $orderDate) : Order
{
//custom code for Doctrine implementation
}
public function addLine(LineNumber $lineId, ProductId $productId, Quantity $quantity) : void
{
//custom code for Doctrine implementation
}
}
class OrderDoctrine implements Order
{
public static function create(OrderId $orderId, DateTimeImmutable $orderDate) : Order
{
//custom code for Doctrine implementation
}
public function addLine(LineNumber $lineId, ProductId $productId, Quantity $quantity) : void
{
//custom code for Doctrine implementation
}
}
class OrderProoph implements Order
{
public static function create(OrderId $orderId, DateTimeImmutable $orderDate) : Order
{
// ES implementation
}
public function addLine(LineNumber $lineId, ProductId $productId, Quantity $quantity) : void
{
// ES implementation
}
public function apply(ProofEventInterface $event)
{
//big ugly switch for AR events
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment