public static function fromJson(array $jsonArray) : Event { $event = new InvoiceIssued(Id::fromString($jsonArray['aggregateRootId']), new Seller($jsonArray['seller']['name'], new TaxIdNumber($jsonArray['seller']['taxIdNumber']), new Address($jsonArray['seller']['street'], $jsonArray['seller']['postalCode'], $jsonArray['seller']['city'], $jsonArray['seller']['country']), new BankAccount($jsonArray['seller']['bankName'], $jsonArray['seller']['bankNumber'], $jsonArray['seller']['bicCode'])), new Buyer($jsonArray['buyer']['name'], new TaxIdNumber($jsonArray['buyer']['taxIdNumber']), new Address($jsonArray['buyer']['street'], $jsonArray['buyer']['postalCode'], $jsonArray['buyer']['city'], $jsonArray['buyer']['country']), new BankAccount($jsonArray['buyer']['bankName'], $jsonArray['buyer']['bankNumber'], $jsonArray['buyer']['bicCode'])), (int) $jsonArray['maxItemNumbers']); $event->occurredOn = new \DateTimeImmutable($jsonArray['occuredOn']); return $event; }
public static function fromJson(array $jsonArray) : Event { $event = new ItemAdded(Id::fromString($jsonArray['aggregateRootId']), $jsonArray['serviceName'], new Amount($jsonArray['amount']['net'], $jsonArray['amount']['vatRate']), (int) $jsonArray['quantity']); $event->occurredOn = new \DateTimeImmutable($jsonArray['occuredOn']); return $event; }