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

collected_info_count

Summary

Fetches the number of collections that match a certain criteria.

Usage

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

Parameters

NameTypeDescriptionRequired
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.
creator_id integer The creator of the information. Only used when object_id is used No.
user_identifier string The user identification string generated by eZ Publish when the information was collected. Only used when object_id is used No.

Returns

The number of collections (as an integer).

Description

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.

Note: 'value' is only valid with 'object_attribute_id'; 'creator_id', 'user_identifier' are only valid with 'object_id'. If 'object_attribute_id' and 'object_id' are provided, only 'object_attribute_id' will be used.

Examples

Example 1

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

Outputs the number of collected information for object with attribute id #42 and value 1.

Example 2

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

Outputs the number of collected information for object with id #42 and information creator id #20.

Example 3

def $collections=fetch( 'content', 'collected_info_count',
                          hash( 'object_id', 42,
                                'user_identifier', '66v8qb7jp7ih9c8d3pmjl25fe3' ) )}
{$collections}

Outputs the number of collected information for object with id #42 and information user's identifier '66v8qb7jp7ih9c8d3pmjl25fe3'.

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

Geir Arne Waaler (30/08/2010 7:34 am)

Balazs Halasy, Geir Arne Waaler


Comments