gnugat/pomm-foundation-bundle
Composer 安装命令:
composer require gnugat/pomm-foundation-bundle
包简介
A pomm-project/foundation integration in symfony
README 文档
README
A pomm-project/foundation integration in Symfony.
This bundle provides Console Commands for your database, as well as a
Pomm's QueryManagerInterface service to be able to make SQL queries in your
Symfony application.
The provided QueryManagerInterface implementation is tied to a Connection:
- the first time it is called, opens a new connection
- the next times it is called, uses the existing connection
- if shutdown is called, closes the connection and goes back to step 1
This allows to keep a 1 to 1 relation between a HTTP request and a database Connection, which is important when the application is a long running process (e.g. tests, FastCGI, AMQP consumer, etc).
It also provides support parameter conversion for:
- booleans: from
falseto'f'and fromtrueto't' \DateTime: string formatted asY-m-d H:i:s T
Integrations
This bundle provides provides the following:
- the service
PommProject\Foundation\QueryManager\QueryManagerInterface - the event listener
Gnugat\PommFoundationBundle\EventListener\ClosingConnectionListener - the console commands:
gnugat-pomm-foundation:database:check-existence(g:p:ch)gnugat-pomm-foundation:database:close-connections(g:p:cl)gnugat-pomm-foundation:database:create(g:p:cr)gnugat-pomm-foundation:database:drop(g:p:dr)gnugat-pomm-foundation:database:dump(g:p:du)gnugat-pomm-foundation:database:execute-file(g:p:ex)gnugat-pomm-foundation:database:launch-console(g:p:la)gnugat-pomm-foundation:database:query(g:p:qu)
Installation
First provide the database configuration:
# config/parameters.yaml.dist
parameters:
database_host: 127.0.0.1
database_port: 5432
database_name: gnugat_pomm_foundation
database_user: postgres
database_password: ~
Then install gnugat/pomm-foundation-bundle using Composer:
composer require gnugat/pomm-foundation-bundle:^0.6
Finally add the following in your config/bundles.php:
<?php
return [
// Your other bundles...
\Gnugat\PommFoundationBundle\GnugatPommFoundationBundle::class => ['all' => true],
];
Usage
Inject the PommProject\Foundation\QueryManager\QueryManagerInterface service in your own services:
<?php
use PommProject\Foundation\QueryManager\QueryManagerInterface;
class MyService
{
private const NO_RESULTS = [];
private $queryManager;
public function __construct(QueryManagerInterface $queryManager)
{
$this->queryManager = $queryManager;
}
public function myMethod(int $id, bool $isDeleted): array
{
$results = iterator_to_array($this->queryManager->query(
'SELECT * FROM my_table WHERE id = $* AND is_deleted = $*',
[
$id,
$isDeleted,
]
));
if (self::NO_RESULTS === $results) {
throw new \Exception("Nothing found in my_table for ID \"$id\"");
}
return $results;
}
}
Further documentation
You can see the current and past versions using one of the following:
- the
git tagcommand - the releases page on Github
- the file listing the changes between versions
You can find more documentation at the following links:
gnugat/pomm-foundation-bundle 适用场景与选型建议
gnugat/pomm-foundation-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.89k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2015 年 09 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 gnugat/pomm-foundation-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gnugat/pomm-foundation-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 10.89k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-23