Skip to content

Commit

Permalink
Remove "civi.api4.createRequest" event listener
Browse files Browse the repository at this point in the history
When civicrm/civicrm-core#23311 is merged, this event listener will be obsolete
  • Loading branch information
jensschuppe committed Apr 27, 2022
1 parent d1cf2d5 commit d6b3ab7
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions Civi/Eck/API/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ class Entity implements API_ProviderInterface, EventSubscriberInterface {
*/
public static function getSubscribedEvents():array {
return [
// TODO: "civi.api4.createRequest" will be removed in CiviCRM Core, see
// https://github.com/civicrm/civicrm-core/pull/23311.
// The "civi.api4.entityTypes" event provides all necessary
// information.
'civi.api4.createRequest' => [['onApi4CreateRequest', Events::W_EARLY]],
'civi.api4.entityTypes' => [['onApi4EntityTypes', Events::W_EARLY]],
];
}
Expand Down Expand Up @@ -84,28 +79,6 @@ public function onApi4EntityTypes(GenericHookEvent $event) {
}
}

/**
* Callback for `civi.api4.createRequest` event.
*
* @param CreateApi4RequestEvent $event
*
* @deprecated
* The "civi.api4.createRequest" event will be removed in CiviCRM Core, see
* https://github.com/civicrm/civicrm-core/pull/23311.
* The "civi.api4.entityTypes" event provides all necessary information.
*/
public function onApi4CreateRequest(CreateApi4RequestEvent $event) {
if (strpos($event->entityName, 'Eck_') === 0) {
$entity_type = substr($event->entityName, strlen('Eck_'));
if (
in_array($entity_type, \CRM_Eck_BAO_EckEntityType::getEntityTypeNames())
) {
$event->className = 'Civi\Api4\EckEntity';
$event->args = [$entity_type];
}
}
}

/**
* Not needed for APIv4
*/
Expand Down

0 comments on commit d6b3ab7

Please sign in to comment.