class Events {
/**
- * Determine whether the API request is allowed for the current user.
- * For successful execution, at least one listener must invoke
- * $event->authorize().
- *
* @see AuthorizeEvent
+ * @deprecated - You may simply use the event name directly. dev/core#1744
*/
const AUTHORIZE = 'civi.api.authorize';
/**
- * Determine which API provider executes the given request. For successful
- * execution, at least one listener must invoke
- * $event->setProvider($provider).
- *
* @see ResolveEvent
+ * @deprecated - You may simply use the event name directly. dev/core#1744
*/
const RESOLVE = 'civi.api.resolve';
/**
- * Apply pre-execution logic
- *
* @see PrepareEvent
+ * @deprecated - You may simply use the event name directly. dev/core#1744
*/
const PREPARE = 'civi.api.prepare';
* Apply post-execution logic
*
* @see RespondEvent
+ * @deprecated - You may simply use the event name directly. dev/core#1744
*/
const RESPOND = 'civi.api.respond';
* Handle any exceptions.
*
* @see ExceptionEvent
+ * @deprecated - You may simply use the event name directly. dev/core#1744
*/
const EXCEPTION = 'civi.api.exception';
*/
public static function allEvents() {
return [
- self::AUTHORIZE,
- self::EXCEPTION,
- self::PREPARE,
- self::RESOLVE,
- self::RESPOND,
+ 'civi.api.authorize',
+ 'civi.api.exception',
+ 'civi.api.prepare',
+ 'civi.api.resolve',
+ 'civi.api.respond',
];
}
* @see \CRM_Utils_Hook::eventDefs
*/
public static function hookEventDefs($e) {
- $e->inspector->addEventClass(self::AUTHORIZE, 'Civi\API\Event\AuthorizeEvent');
- $e->inspector->addEventClass(self::EXCEPTION, 'Civi\API\Event\ExceptionEvent');
- $e->inspector->addEventClass(self::PREPARE, 'Civi\API\Event\PrepareEvent');
- $e->inspector->addEventClass(self::RESOLVE, 'Civi\API\Event\ResolveEvent');
- $e->inspector->addEventClass(self::RESPOND, 'Civi\API\Event\RespondEvent');
+ $e->inspector->addEventClass('civi.api.authorize', 'Civi\API\Event\AuthorizeEvent');
+ $e->inspector->addEventClass('civi.api.exception', 'Civi\API\Event\ExceptionEvent');
+ $e->inspector->addEventClass('civi.api.prepare', 'Civi\API\Event\PrepareEvent');
+ $e->inspector->addEventClass('civi.api.resolve', 'Civi\API\Event\ResolveEvent');
+ $e->inspector->addEventClass('civi.api.respond', 'Civi\API\Event\RespondEvent');
}
}