curtiskelsey/doctrine-repo-helper
Composer 安装命令:
composer require curtiskelsey/doctrine-repo-helper
包简介
Generates a trait to help ease the access of custom repo methods
README 文档
README
This package was created for developers using the doctrine/doctrine-orm-module
to provide a CLI command for generating custom repository getter methods. Adds:
php public/index.php orm:generate-repository-trait
to the doctrine-orm-module cli.
Introduction
Ever worked with Doctrine custom repositories and suffered through
/** @var ExampleRepository $exampleRepo */
$exampleRepo = $this->em->getRepository(Example::class);
$exampleRepo->myMethod();
just to get autocomplete in your IDE?
With this package you can run
php public/index.php orm:generate-repository-trait
To create a trait that will simplify working with custom repositories. Just use the trait it creates to get the magic
use CustomRepositoryAwareTrait;
public function test()
{
$result = $this->getExampleRepository()->myMethod();
}
Setup
You can start with
composer require curtiskelsey/doctrine-repo-helper
then be sure to add
'DoctrineRepoHelper'
to your Zend application's list of loaded modules.
Options
Several options are provided to allow control over the trait created and what entities it serves:
php public/index.php orm:generate-repository-trait --help
Description:
Generate a repository helper trait
Usage:
orm:generate-repository-trait [options]
Options:
--namespace[=NAMESPACE] Declares the namespace
-o, --output[=OUTPUT] Output path [default: "/var/www"]
-c, --className[=CLASSNAME] Classname of the trait [default: "CustomRepositoryAwareTrait"]
--em-getter[=EM-GETTER] Property or method name to access the EntityManager [default: "getObjectManager()"]
-f, --force Overwrite existing trait
--filter[=FILTER] Filter the list of entities getters are created for
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
The generate repository trait command creates a trait that will allow your development
environment to autocomplete custom repository methods
Custom output directory
php public/index.php orm:generate-repository-trait -o My/Special/Path
Custom trait class name and namespace
php public/index.php orm:generate-repository-trait -c SpecialName --namespace=Special\\Namespace
Custom entity manager accessor
php public/index.php orm:generate-repository-trait --em-getter=getMyEntityManager()
Overwrite existing trait file
php public/index.php orm:generate-repository-trait -f
Filter the entity repositories used within the generated trait
php public/index.php orm:generate-repository-trait --filter=Cast
# Only inserts repo getters for entities where "Cast" is found withing the FQCN string
Development
Quickstart
git clonevagrant upvagrant sshphp public/index.php orm:schema-tool:update -fphp public/index.php orm:generate-repository-trait
curtiskelsey/doctrine-repo-helper 适用场景与选型建议
curtiskelsey/doctrine-repo-helper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 224 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 01 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cli」 「repository」 「doctrine」 「extension」 「helper」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 curtiskelsey/doctrine-repo-helper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 curtiskelsey/doctrine-repo-helper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 curtiskelsey/doctrine-repo-helper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Laravel 5 - Repositories to the database layer
Make pimcore migration simple
Plugins for Tactician commands using Doctrine, like wrapping every command in a transaction
Structure for the Laravel Service-Repository Pattern
Use FileMaker through CWP as your backend database
统计信息
- 总下载量: 224
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: mit
- 更新时间: 2019-01-12