makasim/yadm-bundle

该软件包已被 弃用 且不再维护。作者建议使用 formapro/yadm-bundle 软件包。

安装次数: 4,699

依赖者: 1

推荐者: 0

安全性: 0

星标: 7

关注者: 3

分支: 2

类型: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

安装

安装库

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

注册组件

<?php
# /app/AppKernel.php

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

        return $bundles;
    }
}

配置

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'

用法

在您的代码中,您可以从注册表中获取存储

<?php

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

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

许可证

MIT