mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 08:22:41 +08:00
Move events to Flarum\Api namespace
This commit is contained in:
parent
9c77475985
commit
3ece3ca976
@ -11,9 +11,9 @@
|
||||
|
||||
namespace Flarum\Api\Controller;
|
||||
|
||||
use Flarum\Api\Event\WillGetData;
|
||||
use Flarum\Api\Event\WillSerializeData;
|
||||
use Flarum\Api\JsonApiResponse;
|
||||
use Flarum\Event\ConfigureApiController;
|
||||
use Flarum\Event\PrepareApiData;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
@ -91,13 +91,13 @@ abstract class AbstractSerializeController implements ControllerInterface
|
||||
$document = new Document;
|
||||
|
||||
static::$events->fire(
|
||||
new ConfigureApiController($this)
|
||||
new WillGetData($this)
|
||||
);
|
||||
|
||||
$data = $this->data($request, $document);
|
||||
|
||||
static::$events->fire(
|
||||
new PrepareApiData($this, $data, $request, $document)
|
||||
new WillSerializeData($this, $data, $request, $document)
|
||||
);
|
||||
|
||||
$serializer = static::$container->make($this->serializer);
|
||||
|
@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Event;
|
||||
namespace Flarum\Api\Event;
|
||||
|
||||
use DateTime;
|
||||
use Flarum\Api\Serializer\AbstractSerializer;
|
||||
@ -17,10 +17,10 @@ use Flarum\Api\Serializer\AbstractSerializer;
|
||||
/**
|
||||
* Prepare API attributes.
|
||||
*
|
||||
* This event is fired when a serialize is constructing an array of resource
|
||||
* This event is fired when a serializer is constructing an array of resource
|
||||
* attributes for API output.
|
||||
*/
|
||||
class PrepareApiAttributes
|
||||
class Serializing
|
||||
{
|
||||
/**
|
||||
* The class doing the serializing.
|
@ -9,11 +9,11 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Event;
|
||||
namespace Flarum\Api\Event;
|
||||
|
||||
use Flarum\Api\Controller\AbstractSerializeController;
|
||||
|
||||
class ConfigureApiController
|
||||
class WillGetData
|
||||
{
|
||||
/**
|
||||
* @var AbstractSerializeController
|
@ -9,13 +9,13 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Event;
|
||||
namespace Flarum\Api\Event;
|
||||
|
||||
use Flarum\Api\Controller\AbstractSerializeController;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Tobscure\JsonApi\Document;
|
||||
|
||||
class PrepareApiData
|
||||
class WillSerializeData
|
||||
{
|
||||
/**
|
||||
* @var AbstractSerializeController
|
@ -13,8 +13,8 @@ namespace Flarum\Api\Serializer;
|
||||
|
||||
use Closure;
|
||||
use DateTime;
|
||||
use Flarum\Api\Event\Serializing;
|
||||
use Flarum\Event\GetApiRelationship;
|
||||
use Flarum\Event\PrepareApiAttributes;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
@ -71,7 +71,7 @@ abstract class AbstractSerializer extends BaseAbstractSerializer
|
||||
$attributes = $this->getDefaultAttributes($model);
|
||||
|
||||
static::$dispatcher->fire(
|
||||
new PrepareApiAttributes($this, $model, $attributes)
|
||||
new Serializing($this, $model, $attributes)
|
||||
);
|
||||
|
||||
return $attributes;
|
||||
|
Loading…
x
Reference in New Issue
Block a user