eZ Community » Forums » Developer » reverse_related_objects_count...

reverse_related_objects_count improvement, how?

reverse_related_objects_count improvement, how?

Monday 25 February 2013 9:50:50 pm - 4 replies

Hi there.

I just stumbled over an issue with the reverse relations. let me quick describe the case i have.

I simply want to output the amount of the reverse relations via attribute connection of one object. First i thought hey thats gonna be easy. the object should already contain these infos but then i noticed that:

>related_contentobject_array     array     Array(0)
>reverse_related_object_list     array     Array(0)
>related_contentobject_count     string     0
>reverse_related_contentobject_array     array     Array(0)
>reverse_related_contentobject_count     string     0
>linked_contentobject_array     array     Array(0)
>linked_contentobject_count     string     0
>reverse_linked_contentobject_array     array     Array(0)
>reverse_linked_contentobject_count     string     0
>embedded_contentobject_array     array     Array(0)
>embedded_contentobject_count     string     0
>reverse_embedded_contentobject_array     array     Array(0)
>reverse_embedded_contentobject_count     string     0

All information are empty even if i clearly have a object relation! So is that a bug or did i miss to add something? Cron counter? Anything?

Then I thought, hey there is a fetch function as workaround http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/content/Fetch-functions/reverse_related_objects_count quick i could find out that the fetch works and returns a result for me. unfortunately it also returns the relations via object embed for example. but i dont want that. i have a parameter called "all_relations" but thats not what i want.. "true" returns everything and "false" returns those which i dont want.. wouldnt it be smarter to improve that fetch function and replace the "all relations" paremter with a "relation type" parameter which could provide options such as "all", "object embed", "attribute relation" etc.. especially since there must be a seperation in kernel already because when i open the relation tab in the backend while viewing an object then i can see the difference made when doing the connection. i can see the "attribute connection" (which i want to filter!) and see the embed connection. so eZ provides the seperation clearly.

so how do i proceed? is there something i missed completely? is there a filter already? do i have to improve the fetch myself? have i missed something about storing the values correctly in the object?

thanks for the hints already


Tuesday 26 February 2013 12:47:52 am

The reverse_related_objects_count fetch is the right way to go.  I think the documentation is wrong: the "all_relations" parameter is not actually a boolean. It also accepts an array with one or more of these values:


Tuesday 26 February 2013 1:26:53 pm

@Peter Seems like a good candiddate for a Jira issue then. Do you know we have a new documentation maintainer? And he's a dev too, so he likes working with bug-tracker workflows!

Tuesday 26 February 2013 4:09:11 pm

Issue created: https://jira.ez.no/browse/EZP-20510

Who is the new doc person?  Please introduce them!  Or have them introduce themselves...

Tuesday 26 February 2013 8:54:05 pm

Thanks Peter! You were right, it worked!! Thanks. Great stuff, so my problem is solved. But can anyone tell me why we store all these nice attributes in object but they are all empty?


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from