Skip to content

as3io/As3ModlrBundle

Repository files navigation

As3ModlrBundle

Scrutinizer Code Quality Build Status Packagist SensioLabsInsight

Integrates the modlr REST libraries with Symfony.

Installation

To utilize modlr, you must install a persister and an api specification.

To utilize search within modlr, you must install a search client.

Available modules can be found here, or you can write your own!

Install packages with Composer

To install this bundle with support for MongoDB, elasticsearch and the JSON Api Spec, add the following to your composer.json file:

{
    "require": {
        "as3/modlr-bundle": "dev-master",
        "as3/modlr-api-jsonapiorg": "dev-master",
        "as3/modlr-search-elastic": "dev-master",
        "as3/modlr-persister-mongodb": "dev-master"
    }
}

Then, tell Composer to update and install the requested packages:

composer update as3/modlr-bundle --with-dependencies

Register the Bundle

Once installed, register the bundle in your AppKernel.php:

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new As3\Bundle\ModlrBundle\As3ModlrBundle(),
    );

    // ...
}

Configuration

Modlr requires some configuration in order to work. You can use the default config below to get started:

# app/config/config.yml
as3_modlr:
    rest:
        root_endpoint: /api
        debug: "%kernel.debug%"
    adapter:
        type: jsonapiorg
    persisters:
        default:
            type: mongodb
            parameters:
                host: mongodb://localhost:27017
    search_clients:
        default:
            type: elastic

To utilize the external REST API, you must also include modlr's routing file. This will allow modlr to handle all requests to as3_modlr.rest.root_endpoint. To prevent any routing conflicts, you should add this before any other bundle or your application route definitions.

# app/config/routing.yml
as3_modlr_bundle:
    resource: "@As3ModlrBundle/Resources/config/routing.yml"

Next you must define your models! By default, modlr's metadata driver will look for YAML files in app/Resources/As3ModlrBundle/models and app/Resources/As3ModlrBundle/mixins.

You can customize where your definitions are stored by setting the models_dir parameter of your metadata driver. See the bundle configuration documentation for more information.

Usage

See modlr documentation for additional information.

This bundle provides commands to rebuild modlr's metadatacache:

app/console as3:modlr:metadata:cache:clear [model_type] [--no-warm]

Create collection schema:

app/console as3:modlr:schema:create [model_type]

About

Integrates As3 Modlr with Symfony

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published