DKE-Data / agrirouter-sdk-php

This project contains the SDK for the communication with the agrirouter. Everything you need for the onboarding process, secure communication and much more.
Apache License 2.0
2 stars 3 forks source link

OnboardResponse json_encode Farming Software HTTP error #36

Closed danielsundermeier closed 3 years ago

danielsundermeier commented 3 years ago

Ich nutze die Version "dev-feature/enable-custom-time-settings-for-secured-onboarding-and-revoking"

...
$onboardResponse = $onboardService->onboard($onboardParameters, FarmingSoftware::privateKey());
$onboardResponseJson = json_encode($onboardResponse);
object(App\Dto\Onboard\OnboardResponse)#72 (5) {
  ["deviceAlternateId":"App\Dto\Onboard\OnboardResponse":private]=>
  string(36) "XXX"
  ["capabilityAlternateId":"App\Dto\Onboard\OnboardResponse":private]=>
  string(36) "XXX"
  ["sensorAlternateId":"App\Dto\Onboard\OnboardResponse":private]=>
  string(36) "XXX"
  ["connectionCriteria":"App\Dto\Onboard\OnboardResponse":private]=>
  object(App\Dto\Onboard\ConnectionCriteria)#69 (3) {
    ["gatewayId":"App\Dto\Onboard\ConnectionCriteria":private]=>
    string(1) "3"
    ["measures":"App\Dto\Onboard\ConnectionCriteria":private]=>
    string(93) "XXX"
    ["commands":"App\Dto\Onboard\ConnectionCriteria":private]=>
    string(93) "XXX"
    ["host":"App\Dto\Onboard\ConnectionCriteria":private]=>
    uninitialized(string)
    ["port":"App\Dto\Onboard\ConnectionCriteria":private]=>
    uninitialized(string)
    ["clientId":"App\Dto\Onboard\ConnectionCriteria":private]=>
    uninitialized(string)
  }
...
}
PHP Fatal error:  Uncaught Error: Typed property App\\Dto\\Onboard\\ConnectionCriteria::$clientId must not be accessed before initialization in XXX/agrirouter/vendor/dke-data/agrirouter-sdk-php/src/Dto/Onboard/ConnectionCriteria.php:46\nStack trace:\n#0 XXX/agrirouter/vendor/dke-data/agrirouter-sdk-php/src/Dto/Onboard/ConnectionCriteria.php(35): App\\Dto\\Onboard\\ConnectionCriteria->getClientId()\n#1 [internal function]: App\\Dto\\Onboard\\ConnectionCriteria->jsonSerialize()\n#2 XXX/agrirouter/onboarding.php(45): json_encode(Object(App\\Dto\\Onboard\\OnboardResponse))\n#3 {main}\n  thrown in XXX/agrirouter/vendor/dke-data/agrirouter-sdk-php/src/Dto/Onboard/ConnectionCriteria.php on line 46