ansas/propel-helper
Composer 安装命令:
composer require ansas/propel-helper
包简介
Propel helper - helper classes (traits) for Propel2 ORM
README 文档
README
Helper classes (traits) for Propel2 ORM.
Ansas\Propel\Helper\ReadOnly
This trait is a workaround for the Propel bug that you cannot use joinWith() methods anymore when setting tables to readOnly="true" in Propel's schema.xml file. So instead of making tables "readonly" in the scheme just add this trait to every child model you want to make readonly.
For details see propelorm/Propel2#629
Example usage:
<?php use Base\User as BaseUser; use Ansas\Propel\Helper\ReadOnly; class User extends BaseUser { use ReadOnly; }
Ansas\Propel\Helper\SimpleVersionableBehavior
The default behavior "versionable" does not seem to work well with relations and in combination with other behaviors. Therefore I wrote a "simple trait" that does NOT consider versions of related tables. All methods can be used as before.
Three things have to be implemented to use this trait:
- Use the trait in the desired class
- Add the following constant with the name of the versionable behavior active records class (e. g. for an 'Account')
- Optionally add the constant for column names (in default PhpName notation) to skip when populating object
Example usage:
<?php use Base\User as BaseUser; use Ansas\Propel\Helper\SimpleVersionableBehavior; class User extends BaseUser { use SimpleVersionableBehavior; /** * Class name for versionable behavior active records */ const VERSIONABLE_CLASS = 'UserVersion'; /** * Column names (in default PhpName notation) to skip when populating this with version entry */ const VERSIONABLE_POPULATE_SKIP_COLUMNS = ['UpdatedAt', 'Version']; }
Ansas\Propel\Helper\Validation
This trait makes validation of an object quite easy.
Methods:
protected function addValidationError($key, $value, $overwrite = true) protected function resetValidation() public function getValidationErrors() public function hasValidationErrors() abstract protected function doValidate();
TODO
- Write tests
Contribute
Everybody can contribute to this package. Just:
- fork it,
- make your changes and
- send a pull request.
Please make sure to follow PSR-1 and PSR-2 coding conventions.
License
MIT license (see the LICENSE file for more information).
ansas/propel-helper 适用场景与选型建议
ansas/propel-helper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 889 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 04 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「orm」 「propel」 「validation」 「helper」 「readonly」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ansas/propel-helper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ansas/propel-helper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ansas/propel-helper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Kinikit - PHP Application development framework MVC component
PHP Database ORM for Symfony1. Do NOT use for new projects: please move to a newest Symfony release and Doctrine2
Adds request-parameter validation to the SLIM 3.x PHP framework
PeskyORM - annoying ORM that contains tons of exceptions and throws them when anything goes wrong
A jQuery augmented PHP library for creating and validating HTML forms
Free as in freedom php component that generates configuration based hard coded locator
统计信息
- 总下载量: 889
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-29