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
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
tomfun/brander-eav 适用场景与选型建议
tomfun/brander-eav 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 620 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 08 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「search」 「elastica」 「elasticsearch」 「eav」 「entity attribute value」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tomfun/brander-eav 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tomfun/brander-eav 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tomfun/brander-eav 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Elasticsearch PHP integration for your Symfony2 project using Elastica
Provides Elastic Search integration for SilverStripe DataObjects using Elastica
A Laravel package to retrieve data from Google Search Console
Indexed Search Autocomplete - Extends the TYPO3 Core Extension Indexed_Search searchform with an autocomplete feature.
Abstraction Layer to index and search entities
simple api library.
统计信息
- 总下载量: 620
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-04