rsanchez / json

Output ExpressionEngine data in JSON format.
http://devot-ee.com/add-ons/json/
100 stars 236 forks source link

function entries_rel() should be entries_relationship() #25

Closed alana314 closed 10 years ago

alana314 commented 10 years ago

Thanks for this add-on. I'm new to expression engine and am not sure how this used to work, but the is_callable() / call_user_func function for relationships never gets called, because the field type changed from 'rel' to 'relationship'. The relationship id wasn't useful to me in the JSON either, so I have it return the related child ids instead. I rewrote the function:

    protected function entries_relationship($entry_id, $field, $field_data)
    {
        $data = array();

        $query = $this->EE->db->select('child_id')->where('parent_id', $entry_id)->get('relationships');

        foreach($query->result() as $row)
        {
            $data[] = $row;
        }

        return $data;

    }
rsanchez commented 10 years ago

This plugin is a bit outdated. EE changed its relationship field from rel to relationship (along with the database schema) about a year ago, and this plugin has not been updated to reflect that. Take a look answer here: https://github.com/rsanchez/json/issues/23

rsanchez commented 10 years ago

I just pushed a new version that has support for the new relationships field. Version 1.1.0.

grantmx commented 10 years ago

Hey Rob - an chance of further support of Grid? Looks like EE put in a breaking change as of 2.9.0

rsanchez commented 10 years ago

Are you getting an error message? Or WSOD? Or something else?

grantmx commented 10 years ago

No the JSON for the entry comes up, but the grid array is just empty.

Marshall.
Sent from my iPhone

On Aug 11, 2014, at 9:47 PM, Rob Sanchez notifications@github.com wrote:

Are you getting an error message? Or WSOD? Or something else? — Reply to this email directly or view it on GitHub.