X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi%2FAPI%2FKernel.php;h=9f224965fd22c6ae6bcdbbbf91108525e442aec3;hb=f38178e6aa43297ef8b9e08ca1bcb6bd49c81473;hp=0bc3fbd5a83bd080c027fabe9c06b986bf359394;hpb=fa92b4af1c4abf280689cea6445c7a9b99858831;p=civicrm-core.git diff --git a/Civi/API/Kernel.php b/Civi/API/Kernel.php index 0bc3fbd5a8..9f224965fd 100644 --- a/Civi/API/Kernel.php +++ b/Civi/API/Kernel.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.6 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2014 | + | Copyright CiviCRM LLC (c) 2004-2015 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ namespace Civi\API; use Civi\API\Event\AuthorizeEvent; @@ -35,7 +35,7 @@ use Civi\API\Provider\ProviderInterface; /** * @package Civi - * @copyright CiviCRM LLC (c) 2004-2014 + * @copyright CiviCRM LLC (c) 2004-2015 */ class Kernel { @@ -99,7 +99,7 @@ class Kernel { return $this->formatResult($apiRequest, $apiResponse); } catch (\Exception $e) { - $this->dispatcher->dispatch(Events::EXCEPTION, new ExceptionEvent($e, $apiProvider, $apiRequest)); + $this->dispatcher->dispatch(Events::EXCEPTION, new ExceptionEvent($e, $apiProvider, $apiRequest, $this)); if ($e instanceof \PEAR_Exception) { $err = $this->formatPearException($e, $apiRequest); @@ -165,7 +165,7 @@ class Kernel { */ public function resolve($apiRequest) { /** @var ResolveEvent $resolveEvent */ - $resolveEvent = $this->dispatcher->dispatch(Events::RESOLVE, new ResolveEvent($apiRequest)); + $resolveEvent = $this->dispatcher->dispatch(Events::RESOLVE, new ResolveEvent($apiRequest, $this)); $apiRequest = $resolveEvent->getApiRequest(); if (!$resolveEvent->getApiProvider()) { throw new \Civi\API\Exception\NotImplementedException("API (" . $apiRequest['entity'] . ", " . $apiRequest['action'] . ") does not exist (join the API team and implement it!)"); @@ -184,7 +184,7 @@ class Kernel { */ public function authorize($apiProvider, $apiRequest) { /** @var AuthorizeEvent $event */ - $event = $this->dispatcher->dispatch(Events::AUTHORIZE, new AuthorizeEvent($apiProvider, $apiRequest)); + $event = $this->dispatcher->dispatch(Events::AUTHORIZE, new AuthorizeEvent($apiProvider, $apiRequest, $this)); if (!$event->isAuthorized()) { throw new \Civi\API\Exception\UnauthorizedException("Authorization failed"); } @@ -201,7 +201,7 @@ class Kernel { */ public function prepare($apiProvider, $apiRequest) { /** @var PrepareEvent $event */ - $event = $this->dispatcher->dispatch(Events::PREPARE, new PrepareEvent($apiProvider, $apiRequest)); + $event = $this->dispatcher->dispatch(Events::PREPARE, new PrepareEvent($apiProvider, $apiRequest, $this)); return $event->getApiRequest(); } @@ -218,7 +218,7 @@ class Kernel { */ public function respond($apiProvider, $apiRequest, $result) { /** @var RespondEvent $event */ - $event = $this->dispatcher->dispatch(Events::RESPOND, new RespondEvent($apiProvider, $apiRequest, $result)); + $event = $this->dispatcher->dispatch(Events::RESPOND, new RespondEvent($apiProvider, $apiRequest, $result, $this)); return $event->getResponse(); } @@ -281,7 +281,8 @@ class Kernel { * An unhandled exception. * @param array $apiRequest * The full description of the API request. - * @return array (API response) + * @return array + * (API response) */ public function formatApiException($e, $apiRequest) { $data = $e->getExtraParams(); @@ -431,4 +432,5 @@ class Kernel { $this->dispatcher = $dispatcher; return $this; } + }