• Resolved ssimo3

    (@ssimo3)


    I’ve examined this page, and I still have a question:
    https://docs.pods.io/tutorials/get-values-from-a-relationship-field/

    The page reads without qualification that $pod->field("relationship_field") will return a multi-dimensional array. I’m not convinced that it is telling the truth. If the field “relationship_field” defines multiple related items (if “Multiple” is checked in the Pods options), the array will of course be multi-dimensional. My question is: If the “relationship_field” defines only a single related item, will $pod->field("relationship_field") still return a multi-dimensional array?

    It might help to var_dump the results of two relationship fields that are defined as each other’s bidirectional field.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @ssimo3

    When querying a single item the function will also return a single item (read: array).
    When querying for multiple items it will return an array of items (read: arrays).

    Cheers, Jory

Viewing 1 replies (of 1 total)
  • The topic ‘Accessing a Relationship Field in BOTH Directions’ is closed to new replies.