I had tryed with:
{fetch( 'content', 'reverse_related_objects',hash( 'object_id', '202' ) )|count}
{fetch( 'content', 'reverse_related_objects',hash( 'object_id', '197' ) )|count}
{fetch( 'content', 'reverse_related_objects',hash( 'object_id', 202 ) )|count}
{fetch( 'content', 'reverse_related_objects',hash( 'object_id', 197 ) )|count}
I tried all these and the result is 0
From: Luc Chase
Sent: Wednesday, May 18, 2011 4:34 PM
To: Alessio
Cc: mailing ezpublish
Subject: Re: [Sdk-public] Knowing whether an object has at least one reverse
related object
Not really... I just think that you're using the wrong Object ID in the check.
But it's hard to be sure without having a closer look at what you're doing.
I think you can assume it is NOT an eZ bug.
If you go to http://<domain>/<admin_siteaccess>/content/view/full/<node_id>
for the object that has reverse related objects, then get the OBJECT_ID of that
node, I'm sure the reverse_related_objects_count fetch will work.
On 18 May 2011 15:21, Alessio <[email protected]> wrote:
Hi!
Any Idea?
From: Luc Chase
Sent: Monday, May 16, 2011 2:37 PM
To: Alessio
Cc: mailing ezpublish
Subject: Re: [Sdk-public] Knowing whether an object has at least one reverse
related object
I don't remember if you already tried this...
http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/content/Fetch-functions/reverse_related_objects_count
On 16 May 2011 13:32, Luc Chase <[email protected]> wrote:
you said here that node 197 shows reverse related objects... yes?
On 13 May 2011 16:04, Alessio <[email protected]> wrote:
Yes, I'm sure because through the administration interface I've seen the
reports to the objects
but I'll try anyway
I have deliberately left a node without relations.
From: Luc Chase
Sent: Friday, May 13, 2011 4:58 PM
To: Alessio
Cc: mailing ezpublish
Subject: Re: [Sdk-public] Knowing whether an object has at least one
reverse related object
I think it is ok.... you sure that some of those children have
reverse-related-objects?
Try it with a simpler example...
{fetch( 'content', 'node', hash( 'node_id', 88 )
).object.reverse_related_contentobject_count}
replace 88 with the node_id of the one you know has
reverse_related_objects
On 13 May 2011 15:45, Alessio <[email protected]> wrote:
I have:
{foreach fetch_alias( 'children', hash( 'parent_node_id', $node.node_id
) ) as $item }
{
$item.object.reverse_related_contentobject_count} {* <--- copy paste
error *}
{/foreach}
But does not work, It's correct?
From: Luc Chase
Sent: Friday, May 13, 2011 4:36 PM
To: Alessio
Cc: mailing ezpublish
Subject: Re: [Sdk-public] Knowing whether an object has at least one
reverse related object
remember not to confuse object_id and node_id
On 13 May 2011 15:19, Alessio <[email protected]> wrote:
Hi!
{$node.object.reverse_related_contentobject_count} does not work.
I'm searching with {$node|attribute(show,<number>)} ...
From: Luc Chase
Sent: Friday, May 13, 2011 3:56 PM
To: Alessio
Cc: mailing ezpublish
Subject: Re: [Sdk-public] Knowing whether an object has at least one
reverse related object
See also fetch reverse related objects count...
http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/content/Fetch-functions/related_objects_count
On 13 May 2011 14:36, Alessio <[email protected]> wrote:
Hi!
I need to know whether an object has reverse related objects
I found this code:
{def $objects=fetch( 'content', 'reverse_related_objects',
hash( 'object_id', $node_id ) )
$counter = 0}
{foreach $objects as $object}
{set $counter=$counter+1}
{/foreach}
this here:
http://doc.ez.no/eZ-Publish/Techn...ch-functions/reverse_related_objects
In this way I "count" the number of reverse related objects, but
I'm sure there is another way, because I just want to know if the object has
reverse objects related or not, I think it's a waste of resources.
Thanks
--
Sdk-public mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/sdk-public
--
Luc.
M. +44.7040-901-582
--
Luc.
M. +44.7040-901-582
--
Luc.
M. +44.7040-901-582
--
Luc.
M. +44.7040-901-582
--
Luc.
M. +44.7040-901-582
--
Luc.
M. +44.7040-901-582
--
Sdk-public mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/sdk-public