JSON API Server / Resource Mapper Bundle

Build Status SensioLabsInsight

Symfony integration for enm/json-api-server-resource-mappers

  1. Installation
  2. Usage

Installation

You should install enm/json-api-server-bundle before, but it's not required!

composer require enm/json-api-server-resource-mapper-bundle

in your AppKernel:

public function registerBundles(): array
{
    $bundles = [
        // ...
        new Enm\Bundle\JsonApi\Server\ResourceMappers\EnmJsonApiServerResourceMapperBundle(),
        // ...
    ];
    
    return $bundles;
}

Usage

Your resource mappers must be defined as services and tagged with json_api_server.resource_mapper to be detected by this bundle.

services:
    app.resource_mappers.example:
        class: AppBundle\ResourceMappers\ExampleMapper
        tags:
            - { name: 'json_api_server.resource_mapper' }

The registry service, which you will need for dependency injection, is Enm\JsonApi\Server\ResourceMappers\Mapper\ResourceMapperInterface.