Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.



Fetches the number of collections that match a certain criteria.


fetch( 'content', 'collected_info_count',
       hash( [ 'object_attribute_id', object_attribute_id, ]
             [ 'object_id',           object_id,           ]
             [ 'value',               value                ] ) )


object_attribute_id integer The ID number of the target object attribute. No.
object_id integer The ID number of the target content object. No.
value integer Value filtering on the attribute level. No.


The number of collections (as an integer).


This function counts the number of collections based on the provided parameters. An object's ID number (using the "object_id" parameter) or an object attribute's ID number (using the "object_attribute_id" parameter) must be specified. In addition, it is possible to filter out collections that match a certain value. This is typically useful when it comes to counting the number of times a specific value was submitted to a poll. If the "value" parameter is used then the "object_attribute_id" parameter must also be provided. The function returns a positive integer if the system is able to find collections matching the given parameters; if not, zero will be returned.


Example 1

{def $collections=fetch( 'content', 'collected_info_count',
                          hash( 'object_attribute_id', 42,
                                'object_id',           20,
                                'value',                1 ) )}

Outputs the number of times attribute #42 for object number 20 has collected "1".

Balazs Halasy (06/02/2004 12:05 pm)

Balazs Halasy (29/04/2005 8:26 am)


There are no comments.