$caseType = new CRM_Case_DAO_CaseType();
$caseType->id = $event->id;
$refCounts = $caseType->getReferenceCounts();
- $total = array_sum(CRM_Utils_Array::collect('count', $refCounts));
- if (array_sum(CRM_Utils_Array::collect('count', $refCounts))) {
+ $total = array_sum(array_column($refCounts, 'count'));
+ if ($total) {
throw new CRM_Core_Exception(ts("You can not delete this case type -- it is assigned to %1 existing case record(s). If you do not want this case type to be used going forward, consider disabling it instead.", [1 => $total]));
}
}
$contactGroup = CRM_Contact_BAO_GroupContact::getContactGroup($id, 'Added', NULL, FALSE, TRUE, FALSE, TRUE, NULL, TRUE);
if ($contactGroup) {
if ($groupElementType == 'select') {
- $defaults[$fName] = implode(',', CRM_Utils_Array::collect('group_id', $contactGroup));
+ $defaults[$fName] = implode(',', array_column($contactGroup, 'group_id'));
}
else {
foreach ($contactGroup as $group) {
if (!empty($this->items)) {
$this->validateItemStubs();
$queue = \Civi::queue($this->items[0]['queue']);
- $ids = \CRM_Utils_Array::collect('id', $this->items);
+ $ids = array_column($this->items, 'id');
if (count($ids) > 1 && !($queue instanceof \CRM_Queue_Queue_BatchQueueInterface)) {
throw new \CRM_Core_Exception("runItems: Error: Running multiple items requires BatchQueueInterface");
}
}
$idField = $this->getSelect()[0];
- $toDelete = array_diff_key(array_column($items, NULL, $idField), array_flip(array_filter(\CRM_Utils_Array::collect($idField, $this->records))));
+ $toDelete = array_diff_key(array_column($items, NULL, $idField), array_flip(array_column($this->records, $idField)));
$saveAction = \Civi\API\Request::create($this->getEntityName(), 'save', ['version' => 4]);
$saveAction
$tokenProcessor = new TokenProcessor(Civi::dispatcher(), ['schema' => ['activityId']]);
$this->assertEquals(array_merge($this->getActivityTokens(), CRM_Core_SelectValues::domainTokens()), $tokenProcessor->listTokens());
- $html_message = "\n" . implode("\n", CRM_Utils_Array::collect('0', $data)) . "\n";
+ $html_message = "\n" . implode("\n", array_column($data, '0')) . "\n";
$form = $this->getFormObject('CRM_Activity_Form_Task_PDF');
try {
$output = $form->createDocument([$activity['id']], $html_message, []);