nkl-kst / the-sports-db

PHP library to get sports data from TheSportsDB (https://www.thesportsdb.com)
MIT License
22 stars 3 forks source link

JSON mapper error on teams search #11

Closed shutupflanders closed 3 years ago

shutupflanders commented 3 years ago

I'm trying to do searches for various cricket teams, and keep coming across this error if it's not a football team:

{
    "message": "JSON property \"idAPIfootball\" in class \"NklKst\\TheSportsDb\\Entity\\Team\" must not be NULL",
    "exception": "JsonMapper_Exception",
    "file": "/app/vendor/netresearch/jsonmapper/src/JsonMapper.php",
    "line": 216,
    "trace": [
        {
            "file": "/app/vendor/netresearch/jsonmapper/src/JsonMapper.php",
            "line": 449,
            "function": "map",
            "class": "JsonMapper",
            "type": "->"
        },
        {
            "file": "/app/vendor/nkl-kst/the-sports-db/src/Serializer/AbstractSerializer.php",
            "line": 76,
            "function": "mapArray",
            "class": "JsonMapper",
            "type": "->"
        },
        {
            "file": "/app/vendor/nkl-kst/the-sports-db/src/Serializer/Serializer.php",
            "line": 220,
            "function": "serialize",
            "class": "NklKst\\TheSportsDb\\Serializer\\AbstractSerializer",
            "type": "->"
        },
        {
            "file": "/app/vendor/nkl-kst/the-sports-db/src/Client/Endpoint/SearchEndpoint.php",
            "line": 91,
            "function": "serializeTeams",
            "class": "NklKst\\TheSportsDb\\Serializer\\Serializer",
            "type": "->"
        },
        ...

To reproduce, search for a team called "Yorkshire"

Am I doing anything wrong here? Thanks in advance

nkl-kst commented 3 years ago

Hi Martin, thanks for opening this issue and the related PR. I will merge your fix, it will be released with version 1.0.0 (see #8) in the next couple of days.