tomfun/brander-elastica-skeleton

帮助为 friendsofsymfony/elastica-bundle 创建查询

v1.0.1 2017-01-18 13:58 UTC

This package is not auto-updated.

Last update: 2024-09-28 17:49:19 UTC


README

配置

# app/config/config.yml
doctrine_cache:
  aliases:
    brander.bundle.elasticaskeleton.cache_storage: my_apc_cache # or other

  providers:
    my_apc_cache:
      type: apc # or other cacher
      namespace: my_apc_cache_ns
#     namespace: "%kernel.root_dir%/%kernel.environment%/%assets_version%"
<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
            new \Brander\Bundle\ElasticaSkeletonBundle\BranderElasticaSkeletonBundle(),
        );
        // ...
    }
    // ...
}

这只是 doctrine cache bundle 配置,BranderElasticaSkeletonBundle 需要一些缓存适配器,通过别名 brander.bundle.elasticaskeleton.cache_storage

列表服务示例(fos elastica finder 包装器)

# services.yml
services:
 my_bundle.elastica_list.entity:
   class: Iwin\Bundle\UserBundle\Entity\Query\UserElasticaList
   parent: brander.bundle.elasticaskeleton.list # elastica skeleton abstract
   arguments:
     - @fos_elastica.finder.iwin_user.user # fos elastica finder