mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 05:34:30 -04:00
Symfony Serializer
This commit is contained in:
parent
c0483d727f
commit
e721351a4b
@ -32,11 +32,12 @@ class Customer
|
||||
->first();
|
||||
|
||||
if($token && $customer = $this->getCustomer($token->gateway_customer_reference)){
|
||||
return (new \App\PaymentDrivers\CBAPowerBoard\Models\Parse())->decode(ModelsCustomer::class, $customer->resource->data);
|
||||
return (new \App\PaymentDrivers\CBAPowerBoard\Models\Parse())->encode(ModelsCustomer::class, $customer->resource->data);
|
||||
}
|
||||
|
||||
if($customer = $this->findCustomer())
|
||||
return $customer;
|
||||
return (new \App\PaymentDrivers\CBAPowerBoard\Models\Parse())->encode(ModelsCustomer::class, $customer);
|
||||
|
||||
|
||||
return $this->createCustomer($customer_data);
|
||||
|
||||
@ -140,7 +141,7 @@ class Customer
|
||||
if($r->successful())
|
||||
$this->storePaymentMethod($r->object());
|
||||
|
||||
return $r->object()->resource->data ?? $r->throw();
|
||||
return (new \App\PaymentDrivers\CBAPowerBoard\Models\Parse())->encode(ModelsCustomer::class, $r->object()->resource->data) ?? $r->throw();
|
||||
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ class Parse
|
||||
{
|
||||
}
|
||||
|
||||
public function decode($object_type, $document)
|
||||
public function encode($object_type, $document)
|
||||
{
|
||||
|
||||
$phpDocExtractor = new PhpDocExtractor();
|
||||
@ -61,7 +61,7 @@ class Parse
|
||||
$encoders = [new JsonEncoder()];
|
||||
|
||||
$serializer = new Serializer($normalizers, $encoders);
|
||||
nlog($document);
|
||||
|
||||
$data = $serializer->deserialize(json_encode($document), $object_type, 'json', [\Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::SKIP_NULL_VALUES => true]);
|
||||
|
||||
return $data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user