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.

comment_list_by_content_list

Summary

This function fetches comment list by content list.

Usage

fetch( 'comment', 'comment_list_by_content_list',
       hash([ 'contentobject_id_list', contentobject_id_list,]
            [ 'user_id',               user_id,]
            [ 'language_code',         language_code,]
            [ 'status',                status, ]
            [ 'sort_field',            sort_field, ]
            [ 'sort_order',            sort_order, ]
            [ 'offset',                offset, ]
            [ 'length',                length, ]
            [ 'extra_condition',       extra_condition ] ) )

Parameters

NameTypeDescriptionRequired
contentobject_id_list array Content object id list of the objects which comments are based on No
user_id integer User's id of the comment author No
language_code string Language code of comments. If it's not specified, site access ContentObjectLocale will be used No
status integer Status of comment to be fetched. By default it's 1, which means published No
sort_field string Sort field of comment list No
sort_order string Sort order of the list. The value should be 'desc' or 'asc'. By default it's 'desc' No
offset integer Offset of the fetching No
length integer Number of comments which will be fetched No
extra_condition array Other conditions for fetching comments No

Returns

Array if there is record, array() if there is no record under the conditions.listAdd

Description

This function fetches comments based on some conditions. The purpose of this function is to fetch comments on content object collections. It can typically be used for fetching comment on a subtree, section, etc. See fetch content listAdd for detail to get content list.

Examples

Example 1

{def $comments=fetch( 'comment', 'comment_list_by_content_list',
                   hash( 'contentobject_id_list', array( 10, 12 ),
                         'length', '15',
                         'sort_field', 'modified' ) )}

Fetch the latest 15 modified comments on objects on id 10, 12.
Example 2

{def $extra_condition=hash( 'name', 'commenter' )}
 {def $comments=fetch( 'comment', 'comment_list_by_content_list',
                   hash( 'contentobject_id_list', array( 10, 12 ),
                         'length', '15',
                         'sort_field', 'modified',
                         'extra_condition', $extra_condition ) )}

Fetch the latest 15 modified comments on objects 10, 12 whose author is 'commenter'.
Example 3

{def $extra_condition=hash( 'id', array( '>', 2 ) )}
 {def $comments=fetch( 'comment', 'comment_list_by_content_list',
                   hash( 'contentobject_id_list', array( 10, 12 ),
                         'extra_condition', $extra_condition ) )}

Fetch comments on objects 10, 12 whose id are bigger than 2.

Geir Arne Waaler (11/03/2011 11:34 am)

Geir Arne Waaler (11/03/2011 11:34 am)


Comments

There are no comments.