Share » Forums » Developer » Knowing whether an object has at...

Knowing whether an object has at least one reverse related object

Knowing whether an object has at least one reverse related object

Friday 13 May 2011 6:32:06 am - 3 replies

Author Message

André R.

Friday 13 May 2011 6:49:02 am

You can use http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/content/Fetch-functions/reverse_related_objects_count

Or related_contentobject_count / reverse_related_contentobject_count on content object: http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Objects/ezcontentobject

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

alessio asistar

Friday 13 May 2011 8:13:56 am

I have found:

{$node.object.reverse_related_contentobject_count}

but does not work.

Alessio

Luc Chase

Thursday 19 May 2011 12:28:07 pm

{fetch( 'content', 'reverse_related_objects_count', 
hash( 'object_id', $node.contentobject_id,
'all_relations', true() 
))}

The above works for all types of reverse relations ( not just object level, but also attribute-level ). If 'all_relations' is omitted from the fetch statement, it would default to false and the fetch would then not show attribute-level relations.

Your relations, in this case, are at attribute level.  {$node.object.reverse_related_contentobject_count}   works for object-level relations but apparently not for attribute-level.  And it is deprecated anyway.

The Web Application Service Provider

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

36 542 Users on board!

Forums menu