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

This package is abandoned and no longer maintained. The author suggests using the enm/json-api-object-resource-mapper-bundle package instead.

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

1.1.1 2020-01-02 12:47 UTC

This package is auto-updated.

Last update: 2020-01-02 12:49:03 UTC


README

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.