makasim/yadm-bundle

This package is abandoned and no longer maintained. The author suggests using the formapro/yadm-bundle package instead.

Installs: 4 700

Dependents: 1

Suggesters: 0

Security: 0

Stars: 7

Watchers: 3

Forks: 2

Type:symfony-bundle

0.5.2 2018-12-29 21:18 UTC

This package is auto-updated.

Last update: 2019-03-04 12:11:54 UTC


README

Install

Install library

$ composer require formapro/yadm-bundle "mikemccabe/json-patch-php:dev-master as 0.1.1"

Register the bundle

<?php
# /app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            new \Formapro\Yadm\Bundle\YadmBundle(),
        ];

        return $bundles;
    }
}

Configure

yadm:
    mongo_uri: 'mongodb://mongo:27017/db_name'
    models:
      category:
          class: 'Acme\Model\Category'
          collection: 'category'
      product:
          class: 'Acme\Model\Product'
          collection: 'product'
          hydrator: 'app.product.hydrator'

Usage

In your code you can get the storage from registry:

<?php

$registry = $container->get('yadm');

$productStorage = $registry->getStorage('Acme\Model\Category');

Licence

MIT