dmelo/dzend 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dmelo/dzend

Composer 安装命令:

composer require dmelo/dzend

包简介

A set of classes to wrap around Zend v1. It' goal is to make common patterns easier to implement and to transparently add commonly used functionalities.

README 文档

README

DZend is a set of classes to wrap around Zend. It' goal is to make common patterns easier to implement and to transparently add commonly used functionalities.

If a Zend class is wrapped at DZend, then it's name will be the same as the Zend class but with a D at the beginning, but there is no abstract tables at DZend. For instance, DZend_Db_Table extends Zend_Db_Table_Abstract.

Prerequisite

PHP 5.4 >=

Bootstrap

The bootstrap instantiate a few commonly used tools.

Logger

Instantiate Zend_Log and write it on registry. To access this instance just call:

Zend_Registry::get('looger');

All the logs will be written on the file public/tmp/log.txt.

Internationalization

A Zend_Translate instance is already included on the registry translate. Similarly to the logger, to access the translate object, call:

Zend_Registry::get('translate');

The detection of the locale is made automatically, in case none is found, en_US is the default.

Controller

TODO...

Database

DZend_Db_Table

The class DZend_Db_Table implements the __call magic function to add a few functionalities to select queries. For instance, let DbTable_User extends DZend_Db_Table and represents the user database table. To find all female users, just use the call $userDb->findByGender('f'), where $userDb is an instance of DbTable_User. DZend parses the function name recognize the columns.

The "And" can be used to separate column names. The method of format findByColumnAAndColumnBAndColumnC($a, $b, $c) will return a Zend_Db_Table_Rowset containing all rows that have column_a = $a AND column_b = $b AND column_c = $c.

To fetch just a Zend_Db_Table_Row instead of a rowset, use findRowBy, instead of findBy.

Similar to findBy, there is also deleteBy, which deletes all matching rows.

Registry Cache

If the class extending DZend_Db_Table set $_allowRequestCache to true, then rows will be cached by ID, when using the methods findById or findRowById. Beware that the cache lasts only during the request. Also, be mindful that changed objects are not updated on cache. If an object is fetched and then updated. Feching the object a second time will bring the old object.

insertMulti Method

While Zend_Db_Table provides a method insert that inserts a single row, DZend_Db_Table provides the insertMulti method that gets an array of data arrays, to insert multiple rows.

DZend_Db_Table_Row

Usually SQL names for databases, tables and columns uses underscore notation while programming uses camel notation. DZend_Db_Table_Row automatically converts between one another. Let $row be an instance of DZend_Db_Table_Row. $row->columnName can be used to access the column value for column_name.

CurrentUser

The pre-requisite to get this trait working properly is to have the auth to store the currently logged in user row on DZend_Session_Namespace::get('session')->user. It assumes that the id attribute holds the primary key for the user.

DZend_CurrentUser is a trait that provider two methods, _getUserRow() and _getUserId(). In case there is not user logged, in it returns null.

By default, DZend_Model and DZend_Db_Table already extends this trait.

PHPUnit

TODO...

dmelo/dzend 适用场景与选型建议

dmelo/dzend 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 148 次下载、GitHub Stars 达 1, 最近一次更新时间为 2014 年 05 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 dmelo/dzend 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 148
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-05-04