本文整理汇总了PHP中CRM_Core_BAO_CustomGroup::find方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomGroup::find方法的具体用法?PHP CRM_Core_BAO_CustomGroup::find怎么用?PHP CRM_Core_BAO_CustomGroup::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomGroup
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomGroup::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createGroup
/**
* Helper function to create Custom Group
*
* @deprecated - use functions on test case parent class
*
* @param $group
* @param null $extends
* @param bool $isMultiple
*
* @return object of created group
*/
static function createGroup($group, $extends = NULL, $isMultiple = FALSE)
{
if (empty($group)) {
if (isset($extends) && !is_array($extends)) {
$extends = array($extends);
}
$group = array('title' => 'Test_Group', 'name' => 'test_group', 'extends' => $extends, 'style' => 'Inline', 'is_multiple' => $isMultiple, 'is_active' => 1, 'version' => 3);
} else {
// this is done for backward compatibility
// with tests older than 3.2.3
if (isset($group['extends']) && !is_array($group['extends'])) {
$group['extends'] = array($group['extends']);
}
}
$result = civicrm_api('custom_group', 'create', $group);
if ($result['is_error']) {
return NULL;
}
// this is done for backward compatibility
// with tests older than 3.2.3
require_once 'CRM/Core/BAO/CustomGroup.php';
$group = new CRM_Core_BAO_CustomGroup();
$group->id = $result['id'];
$group->find(TRUE);
return $group;
}
示例2: testDeleteGroup
/**
* Test deleteGroup.
*/
public function testDeleteGroup()
{
$customGroupTitle = 'My Custom Group';
$groupParams = array('title' => $customGroupTitle, 'name' => 'my_custom_group', 'style' => 'Tab', 'extends' => 'Individual', 'is_active' => 1);
$customGroup = $this->customGroupCreate($groupParams);
$groupObject = new CRM_Core_BAO_CustomGroup();
$groupObject->id = $customGroup['id'];
$groupObject->find(TRUE);
$isDelete = CRM_Core_BAO_CustomGroup::deleteGroup($groupObject);
// Check it worked!
$this->assertEquals(TRUE, $isDelete);
$this->assertDBNull('CRM_Core_DAO_CustomGroup', $customGroup['id'], 'title', 'id', 'Database check for custom group record.');
}