tomfun/brander-eav 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tomfun/brander-eav

最新稳定版本:v1.2.2

Composer 安装命令:

composer require tomfun/brander-eav

包简介

helps to create entity that have different attributes (fields) in same database. Also provide integration with elastic search friendsofsymfony/elastica-bundle

README 文档

README

How it work, what is it

read in russian

Install bundle

composer require tomfun/brander-eav
// app/AppKernel.php
    public function registerBundles()
    // ...
        new \Brander\Bundle\EAVBundle\BranderEAVBundle(),
        new FOS\ElasticaBundle\FOSElasticaBundle(),
        new JMS\AopBundle\JMSAopBundle(),
        new JMS\SerializerBundle\JMSSerializerBundle(), // optional
        new JMS\DiExtraBundle\JMSDiExtraBundle($this),

    // ...
# app/config/parameters.yml
# same add to app/config/parameters.yml.dist
parameters:
# .........
    locale: ru

just enable elastica bundle and add base configuration

#app/config/config.yml
fos_elastica:
    clients:
        default: { host: localhost, port: 9200 }
    indexes:
        app: ~

Requirements

  • FOSElasticaBundle()
  • JMSAopBundle()
  • JMSDiExtraBundle($this)
  • JS router with generate function
  • Twigjs filters (for listing frontend)
    • trans
    • transchoice
  • Compatible gulp task with twigjs compilation

Configuration

First at all

  • you must have entity you want to search
  • query php class
  • search result class

Config example

brander_eav:
  fixturesDirectory: /home/tomfun/fixtures-data
  useJmsSerializer: false #turn off standard elastica serializer for known entity
  list_class_map:
    - Sdelka\Bundle\AdvertBundle\Entity\Advert #entity with eav values, auto find query and result classes in model dir

this expanded as:

brander_eav:
  useJmsSerializer: false #turn off standard elastica serializer for known entity
  list_class_map:
    - 
      entity: Sdelka\Bundle\AdvertBundle\Entity\Advert #orm entity
      query: Sdelka\Bundle\AdvertBundle\Model\AdvertQuery #query class. must exist.
      result: Sdelka\Bundle\AdvertBundle\Model\AdvertQuery #result class. must exist.
      serviceClass: Brander\Bundle\EAVBundle\Service\Elastica\EavList #service class

also you must implement some interfaces (e.g. SearchableEntityInterface). name of listing service in this case: "brander_eav.elastica.list.sdelka_advert.advert"

if you don't need auto configuration of elastica bundle, you can use simple serialize directive (searchable) and configure elastic search bundle manually:

brander_eav:
  useJmsSerializer: false #turn off standard elastica serializer for known entity
  searchable:
    - Sdelka\Bundle\AdvertBundle\Entity\Advert #orm entity

show auto-generated lists (inner elastica index name / type name):

app/console de:cont | grep "brander_eav.elastica.list"

Routing

in app/config/routing.yml add this lines:

# app/config/routing.yml
eav:
  resource: "@BranderEAVBundle/Resources/config/routing.yml"
  options:
    i18n: false
    expose: true

default admin url is /admin/eav/manage/

Security

if you want grant access for admin part for non admin (example: manager)

brander_eav:
  useJmsSerializer: false #turn off standard elastica serializer for known entity
  manageRole: ROLE_MANAGER

or for anonymous: manageRole: "anon." or rewrite voter service: brander_eav.security.universal_voter.

also look into ElasticaSkeletonBundle

todo:

  • vendor/werkint/stats-bundle/src/Service/Security/Voter/StatsVoter.php supportsAttribute
  • backbone.modelbinder -> stickit

wtf: cache.app voter Twig\BranderEAVExtension \Brander\Bundle\EAVBundle\DependencyInjection\BranderEAVExtension::getConfiguration

统计信息

  • 总下载量: 620
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-04