ccmbenchmark/ting_bundle

ccmbenchmark/ting 的 Symfony 扩展包。提供一个接口,在 Symfony 中使用轻量级的数据映射器。

安装数: 82,433

依赖者: 1

建议者: 0

安全: 0

星标: 0

关注者: 5

分叉: 2

开放问题: 3

类型:symfony-bundle


README

  1. 使用 composer require ccmbenchmark/ting_bundle 安装 Ting 扩展包
  2. 在 AppKernel.php 中加载扩展包
    new CCMBenchmark\TingBundle\TingBundle(),

配置

#!yaml

    ting:
        repositories:
            Acme:
                namespace: Acme\DemoBundle\Entity
                directory: "@DemoBundle/Entity"
                options:
                    #pass options to your repository
                    Acme\DemoBundle\BazRepository:
                        extra:
                            bar: hello
                            foo: world
                    Acme\DemoBundle\FooRepository:
                        extra:
                            bar: hello
                            foo: world
                    default:
                        connection: main
                        database: baz

        connections:
            main:
                namespace: CCMBenchmark\Ting\Driver\Mysqli
                master:
                    host:     localhost
                    user:     world_sample
                    password: world_sample
                    port:     3306
                slaves:
                    slave1:
                        host:     127.0.0.1
                        user:     world_sample_ro
                        password: world_sample_ro
                        port:     3306
                    slave2:
                        host:     127.0.1.1
                        user:     world_sample_ro
                        password: world_sample_ro
                        port:     3306

        databases_options:
            baz:
                timezone: 'Europe/Paris'

使用方法

在控制器中调用

#!php

    $this->get('ting')->get('\Acme\DemoBundle\Entity\AcmeRepository');