本文整理汇总了PHP中CRM_Core_BAO_Note::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Note::fetch方法的具体用法?PHP CRM_Core_BAO_Note::fetch怎么用?PHP CRM_Core_BAO_Note::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Note
的用法示例。
在下文中一共展示了CRM_Core_BAO_Note::fetch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Given the list of params in the params array, fetch the object
* and store the values in the values array
*
* @param array $params
* Input parameters to find object.
* @param array $values
* Output values of the object.
* @param int $numNotes
* The maximum number of notes to return (0 if all).
*
* @return object
* $notes Object of CRM_Core_BAO_Note
*/
public static function &getValues(&$params, &$values, $numNotes = self::MAX_NOTES)
{
if (empty($params)) {
return NULL;
}
$note = new CRM_Core_BAO_Note();
$note->entity_id = $params['contact_id'];
$note->entity_table = 'civicrm_contact';
// get the total count of notes
$values['noteTotalCount'] = $note->count();
// get only 3 recent notes
$note->orderBy('modified_date desc');
$note->limit($numNotes);
$note->find();
$notes = array();
$count = 0;
while ($note->fetch()) {
$values['note'][$note->id] = array();
CRM_Core_DAO::storeValues($note, $values['note'][$note->id]);
$notes[] = $note;
$count++;
// if we have collected the number of notes, exit loop
if ($numNotes > 0 && $count >= $numNotes) {
break;
}
}
return $notes;
}