It seems the setPayload tries to call an abstract parent::setPayload, should probably be removed.
namespace ReachDigital\Subscription\Model\ProductPlan {
final class SubmitFormGlobalScope extends \Prooph\Common\Messaging\Command
{
use \Prooph\Common\Messaging\PayloadTrait;
protected $messageName = 'ReachDigital\Subscription\Model\ProductPlan\SubmitFormGlobalScope';
public function planId(): PlanId
{
return PlanId::fromString($this->payload['planId']);
}
public function productId(): ProductId
{
return ProductId::fromScalar($this->payload['productId']);
}
public function enabled(): Enabled
{
return Enabled::fromScalar($this->payload['enabled']);
}
public function enabledOnFrontend(): EnabledOnFrontend
{
return EnabledOnFrontend::fromScalar($this->payload['enabledOnFrontend']);
}
public function title(): Title
{
return Title::fromString($this->payload['title']);
}
public function description(): Description
{
return Description::fromString($this->payload['description']);
}
public function schedule(): Schedule
{
return Schedule::fromArray($this->payload['schedule']);
}
public function interval(): Interval
{
return Interval::fromArray($this->payload['interval']);
}
public function initialPrice(): InitialPrice
{
return InitialPrice::fromScalar($this->payload['initialPrice']);
}
public function installmentPrice(): InstallmentPrice
{
return InstallmentPrice::fromScalar($this->payload['installmentPrice']);
}
public static function with(PlanId $planId, ProductId $productId, Enabled $enabled, EnabledOnFrontend $enabledOnFrontend, Title $title, Description $description, Schedule $schedule, Interval $interval, InitialPrice $initialPrice, InstallmentPrice $installmentPrice): SubmitFormGlobalScope
{
return new self([
'planId' => $planId->toString(),
'productId' => $productId->toScalar(),
'enabled' => $enabled->toScalar(),
'enabledOnFrontend' => $enabledOnFrontend->toScalar(),
'title' => $title->toString(),
'description' => $description->toString(),
'schedule' => $schedule->toArray(),
'interval' => $interval->toArray(),
'initialPrice' => $initialPrice->toScalar(),
'installmentPrice' => $installmentPrice->toScalar(),
]);
}
protected function setPayload(array $payload): void
{
if (! isset($payload['planId']) || ! is_string($payload['planId'])) {
throw new \InvalidArgumentException("Key 'planId' is missing in payload or is not a string");
}
if (! isset($payload['productId']) || ! is_int($payload['productId'])) {
throw new \InvalidArgumentException("Key 'productId' is missing in payload or is not a int");
}
if (! isset($payload['enabled']) || ! is_bool($payload['enabled'])) {
throw new \InvalidArgumentException("Key 'enabled' is missing in payload or is not a bool");
}
if (! isset($payload['enabledOnFrontend']) || ! is_bool($payload['enabledOnFrontend'])) {
throw new \InvalidArgumentException("Key 'enabledOnFrontend' is missing in payload or is not a bool");
}
if (! isset($payload['title']) || ! is_string($payload['title'])) {
throw new \InvalidArgumentException("Key 'title' is missing in payload or is not a string");
}
if (! isset($payload['description']) || ! is_string($payload['description'])) {
throw new \InvalidArgumentException("Key 'description' is missing in payload or is not a string");
}
if (! isset($payload['schedule']) || ! is_array($payload['schedule'])) {
throw new \InvalidArgumentException("Key 'schedule' is missing in payload or is not an array");
}
if (! isset($payload['interval']) || ! is_array($payload['interval'])) {
throw new \InvalidArgumentException("Key 'interval' is missing in payload or is not an array");
}
if (! isset($payload['initialPrice']) || ! is_float($payload['initialPrice'])) {
throw new \InvalidArgumentException("Key 'initialPrice' is missing in payload or is not a float");
}
if (! isset($payload['installmentPrice']) || ! is_float($payload['installmentPrice'])) {
throw new \InvalidArgumentException("Key 'installmentPrice' is missing in payload or is not a float");
}
parent::setPayload($payload);
}
}
}