getValue('activity_type'); if ($activityType) { \CRM_Core_Error::deprecatedFunctionWarning('Use activity_type_id:name instead of activity_type in APIv4'); $result = OptionValue::get(FALSE) ->addWhere('name', '=', $activityType) ->addWhere('option_group.name', '=', 'activity_type') ->execute(); if ($result->count() !== 1) { throw new \Exception('Activity type must match a *single* type'); } $request->addValue('activity_type_id', $result->first()['value']); } } /** * @param \Civi\Api4\Generic\DAOCreateAction $request * * @return bool */ protected function applies(DAOCreateAction $request) { return $request->getEntityName() === 'Activity'; } }