承接 pomm-project/pomm-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

pomm-project/pomm-bundle

Composer 安装命令:

composer require pomm-project/pomm-bundle

包简介

The Symfony2 bundle for Pomm2

README 文档

README

Build Status Scrutinizer Code Quality

Although this bundle usable already, it is a work in progress. New features will be added.

This bundle provides a pomm service to use the Pomm2 Model Manager with Symfony.

Note:

If you are looking for a bundle for Pomm 1.x then look up for pomm/pomm-bundle on packagist.

Installation

composer require pomm-project/pomm-bundle

Note:

Pomm bundle support symfony flex, the recipe add route for the profiler pannel and a minimal configuration with a db session loaded from DATABASE_URL environment variable.

Setup

Add the bundle in the app/AppKernel.php file:

<?php // app/AppKernel.php
// …
    public function registerBundles()
    {
        $bundles = [
        // other bundles
        new \PommProject\PommBundle\PommBundle(),
        // other bundles
        ];

Configuration

In the app/config folder, store your db connection parameters in parameters.yml:

parameters:
    db_host1: 127.0.0.1
    db_port1: 5432
    db_name1: my_db_name
    db_user1: user
    db_password1: pass

    db_host2: 127.0.0.1
#   etc.

Sensitive information such as database credentials should not be committed in Git. To help you prevent committing those files and folders by accident, the Symfony Standard Distribution comes with a file called .gitignore which list resources that Git should ignore, included this parameters.yml file. You can now refer to these parameters elsewhere by surrounding them with percent (%).

Add an entry in config.yml:

pomm:
    configuration:
        my_db1:
            dsn: "pgsql://%db_user1%:%db_password1%@%db_host1%:%db_port1%/%db_name1%"
            pomm:default: true
        my_db2:
            dsn: "pgsql://%db_user2%:%db_password2%@%db_host2%:%db_port2%/%db_name2%"
            session_builder: "pomm.session_builder"
    logger:
        service: "@logger"

And in routing_dev.yml:

_pomm:
    resource: "@PommBundle/Resources/config/routing.yml"
    prefix:   /_pomm

Command line interface

The Pomm CLI is available through the bin/console utility. It is possible to browse the database or to generate model files.

$ ./bin/console pomm:generate:relation-all -d src -a 'AppBundle\Model' my_db1 student

If you want generate schema, you need to use the model manager session builder:

pomm:
    configuration:
        my_db1:
            dsn: "pgsql://%db_user1%:%db_password1%@%db_host1%:%db_port1%/%db_name1%"
            session_builder: "pomm.model_manager.session_builder"

Using Pomm from the controller

The Pomm service is available in the DIC as any other service:

    function myAction($name)
    {
        $students = $this->get('pomm')['my_db2']
            ->getModel('\AppBundle\Model\MyDb1\PublicSchema\StudentModel')
            ->findWhere('name = $*', [$name])
            ;

        …

It is now possible to tune and create a model layer as described in the quick start guide.

Param converter

This bundle provide a param converter to convert request to a flexible entity. The converter search in the request the parameters with names matching primary key.

You can specify witch connexion use in the option:

/**
 * @ParamConverter("student", options={"session": "my_db2"})
 */
public function getAction(Student $student)

By default, the model used for find the entity is deduce by adding Model to entity class name. If you have a different class name, you can use the model option:

/**
 * @ParamConverter("student", options={"model": "StudentModel"})
 */
public function getAction(Student $student)

This feature require sensio/framework-extra-bundle.

Serializer

You can use the serializer component to serialize entities.

Property info

This bundle also provide property info support to retrieve flexible entity properties informations.

Poolers as service

If you need to add additional poolers into the session builder all you need to do is tag a service definition with pomm.pooler

Model and Model layer as a service

Model and model layer objects can be registered as a service. For this to work properly you have to tag your service correctly and remove class:session_builder from configuration.

Models must be tagged with pomm.model and layers with pomm.model_layer

Both of those tags have the following parameters:

  • pooler which is the name of a default pooler service, if left blank the default is used
  • session which is the name of a default session service this is used from, if left blank the default is used

pomm-project/pomm-bundle 适用场景与选型建议

pomm-project/pomm-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 200.98k 次下载、GitHub Stars 达 81, 最近一次更新时间为 2014 年 12 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「database」 「orm」 「symfony」 「postgresql」 「pomm」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 pomm-project/pomm-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 pomm-project/pomm-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 pomm-project/pomm-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 200.98k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 83
  • 点击次数: 9
  • 依赖项目数: 5
  • 推荐数: 0

GitHub 信息

  • Stars: 81
  • Watchers: 10
  • Forks: 29
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-23