h4kuna / ares

Download information about companies from ARES, PSR-17 ready
47 stars 17 forks source link

Undefined property: stdClass::$datumVzniku #37

Closed josefbk closed 10 months ago

josefbk commented 10 months ago

Ahoj, když zkouším následující kod

<?php

require_once './vendor/autoload.php';
ini_set('zend.assertions', 0);
use h4kuna\Ares;
/** @var Ares\Ares $ares */
$ares = (new Ares\AresFactory())->create();
$numbers = ['one' => '67909442', 'two' => '27735753'];

try {
    foreach ($ares->loadBasicMulti($numbers) as $name => $r) {
        var_dump($name, $r->company);
    }
} catch (Ares\Exceptions\ServerResponseException $e) {
    // no response from server or broken json
}

tak dostanu:

Warning: Undefined property: stdClass::$datumVzniku in /opt/app/www/test/vendor/h4kuna/ares/src/Ares/Core/JsonToDataTransformer.php on line 52

Fatal error: Uncaught TypeError: Cannot assign null to property h4kuna\Ares\Ares\Core\Data::$created of type DateTimeImmutable in /opt/app/www/test/vendor/h4kuna/ares/src/Ares/Core/JsonToDataTransformer.php:52 Stack trace: #0 /opt/app/www/test/vendor/h4kuna/ares/src/Ares/Core/ContentProvider.php(45): h4kuna\Ares\Ares\Core\JsonToDataTransformer->transform(Object(stdClass)) #1 /opt/app/www/test/test.php(11): h4kuna\Ares\Ares\Core\ContentProvider->loadByIdentificationNumbers(Array) #2 {main} thrown in /opt/app/www/test/vendor/h4kuna/ares/src/Ares/Core/JsonToDataTransformer.php on line 52

nevím teda jestli je chyba, že Ares nevrátí datum nebo že Data mají created nenulový, ale chtělo by to nějak ošetřit

composer:

{
    "require": {
        "h4kuna/ares": "v3.0.4",
        "guzzlehttp/guzzle": "7.8.1"
    }
}
h4kuna commented 10 months ago

Ahoj, dík za nahlášení. Opraveno v3.0.5