Как мы получим [hydra: view] или [hydra: member] внутри хранилища Symfony? - PullRequest
0 голосов
/ 21 октября 2019

Мне нужно получить [hydra: member] и [hydra: view] из ответа json.

{
    "@context": "/api/contexts/Resource",
    "@id": "/api/resources",
    "@type": "hydra:Collection",
    "hydra:member": [
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/209",
                "@type": "ResourceHasResourceAttributes",
                "id": 209,
                "resource": "/api/resources/188",
                "resourcetAttributes": "/api/resource_attributes/11"
            },
            "id": 188,
            "name": "20",
            "description": "Collision",
            "resourceNumber": "10",
            "attributeName": "Collision",
            "attriButeId": 11
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/210",
                "@type": "ResourceHasResourceAttributes",
                "id": 210,
                "resource": "/api/resources/188",
                "resourcetAttributes": "/api/resource_attributes/17"
            },
            "id": 188,
            "name": "20",
            "description": "Collision",
            "resourceNumber": "10",
            "attributeName": "Other",
            "attriButeId": 17
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/211",
                "@type": "ResourceHasResourceAttributes",
                "id": 211,
                "resource": "/api/resources/189",
                "resourcetAttributes": "/api/resource_attributes/11"
            },
            "id": 189,
            "name": "21",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Collision",
            "attriButeId": 11
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/212",
                "@type": "ResourceHasResourceAttributes",
                "id": 212,
                "resource": "/api/resources/189",
                "resourcetAttributes": "/api/resource_attributes/17"
            },
            "id": 189,
            "name": "21",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Other",
            "attriButeId": 17
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/213",
                "@type": "ResourceHasResourceAttributes",
                "id": 213,
                "resource": "/api/resources/190",
                "resourcetAttributes": "/api/resource_attributes/11"
            },
            "id": 190,
            "name": "22",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Collision",
            "attriButeId": 11
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/214",
                "@type": "ResourceHasResourceAttributes",
                "id": 214,
                "resource": "/api/resources/190",
                "resourcetAttributes": "/api/resource_attributes/17"
            },
            "id": 190,
            "name": "22",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Other",
            "attriButeId": 17
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/215",
                "@type": "ResourceHasResourceAttributes",
                "id": 215,
                "resource": "/api/resources/191",
                "resourcetAttributes": "/api/resource_attributes/11"
            },
            "id": 191,
            "name": "23",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Collision",
            "attriButeId": 11
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/216",
                "@type": "ResourceHasResourceAttributes",
                "id": 216,
                "resource": "/api/resources/191",
                "resourcetAttributes": "/api/resource_attributes/17"
            },
            "id": 191,
            "name": "23",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Other",
            "attriButeId": 17
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/217",
                "@type": "ResourceHasResourceAttributes",
                "id": 217,
                "resource": "/api/resources/192",
                "resourcetAttributes": "/api/resource_attributes/11"
            },
            "id": 192,
            "name": "24",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Collision",
            "attriButeId": 11
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/218",
                "@type": "ResourceHasResourceAttributes",
                "id": 218,
                "resource": "/api/resources/192",
                "resourcetAttributes": "/api/resource_attributes/17"
            },
            "id": 192,
            "name": "24",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Other",
            "attriButeId": 17
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/219",
                "@type": "ResourceHasResourceAttributes",
                "id": 219,
                "resource": "/api/resources/193",
                "resourcetAttributes": "/api/resource_attributes/11"
            },
            "id": 193,
            "name": "25",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Collision",
            "attriButeId": 11
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/220",
                "@type": "ResourceHasResourceAttributes",
                "id": 220,
                "resource": "/api/resources/193",
                "resourcetAttributes": "/api/resource_attributes/17"
            },
            "id": 193,
            "name": "25",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Other",
            "attriButeId": 17
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/221",
                "@type": "ResourceHasResourceAttributes",
                "id": 221,
                "resource": "/api/resources/194",
                "resourcetAttributes": "/api/resource_attributes/11"
            },
            "id": 194,
            "name": "26",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Collision",
            "attriButeId": 11
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/222",
                "@type": "ResourceHasResourceAttributes",
                "id": 222,
                "resource": "/api/resources/194",
                "resourcetAttributes": "/api/resource_attributes/17"
            },
            "id": 194,
            "name": "26",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Other",
            "attriButeId": 17
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/223",
                "@type": "ResourceHasResourceAttributes",
                "id": 223,
                "resource": "/api/resources/195",
                "resourcetAttributes": "/api/resource_attributes/11"
            },
            "id": 195,
            "name": "27",
            "description": "Collision",
            "resourceNumber": "5",
            "attributeName": "Collision",
            "attriButeId": 11
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/224",
                "@type": "ResourceHasResourceAttributes",
                "id": 224,
                "resource": "/api/resources/195",
                "resourcetAttributes": "/api/resource_attributes/17"
            },
            "id": 195,
            "name": "27",
            "description": "Collision",
            "resourceNumber": "5",
            "attributeName": "Other",
            "attriButeId": 17
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/225",
                "@type": "ResourceHasResourceAttributes",
                "id": 225,
                "resource": "/api/resources/196",
                "resourcetAttributes": "/api/resource_attributes/11"
            },
            "id": 196,
            "name": "28",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Collision",
            "attriButeId": 11
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/226",
                "@type": "ResourceHasResourceAttributes",
                "id": 226,
                "resource": "/api/resources/196",
                "resourcetAttributes": "/api/resource_attributes/17"
            },
            "id": 196,
            "name": "28",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Other",
            "attriButeId": 17
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/227",
                "@type": "ResourceHasResourceAttributes",
                "id": 227,
                "resource": "/api/resources/197",
                "resourcetAttributes": "/api/resource_attributes/11"
            },
            "id": 197,
            "name": "29",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Collision",
            "attriButeId": 11
        },
        {
            "0": {
                "@id": "/api/resource_has_resource_attributes/228",
                "@type": "ResourceHasResourceAttributes",
                "id": 228,
                "resource": "/api/resources/197",
                "resourcetAttributes": "/api/resource_attributes/17"
            },
            "id": 197,
            "name": "29",
            "description": "Collision",
            "resourceNumber": "1",
            "attributeName": "Other",
            "attriButeId": 17
        }
    ],
    "hydra:totalItems": 7180,
    "hydra:view": {
        "@id": "/api/assessment/resources/3?page=3",
        "@type": "hydra:PartialCollectionView",
        "hydra:first": "/api/assessment/resources/3?page=1",
        "hydra:last": "/api/assessment/resources/3?page=359",
        "hydra:previous": "/api/assessment/resources/3?page=2",
        "hydra:next": "/api/assessment/resources/3?page=4"
    }
}
...