icanboogie/bind-facets

将 icanboogie/facets 绑定到 ICanBoogie

v5.0.0 2021-06-01 19:50 UTC

This package is auto-updated.

Last update: 2024-08-23 17:19:48 UTC


README

Release Build Status Code Quality Code Coverage Packagist

icanboogie/bind-facets 包通过使用其自动配置功能将 icanboogie/facets 绑定到 ICanBoogie,并提供以下功能

  • activerecord_facets 配置提供合成器。
  • Model 实例提供 criteria 原型属性。
  • Model 实例提供 criterion_list 原型属性。
  • Model 实例提供 fetch_record() 原型方法。
  • Model 实例提供 fetch_records() 原型方法。

原型绑定提示

由于大多数功能都通过原型方法提供,您的编辑器可能会抱怨未知的方法,在这种情况下,只需使用 ModelBindings 特性。

以下示例演示了如何为 fetch_records 方法提示您的代码。注意注释中的类型提示 Model|ModelBindings

<?php

use ICanBoogie\ActiveRecord\Model;
use ICanBoogie\Binding\Facets\ModelBindings;
use ICanBoogie\Facets\RecordCollection;

/**
 * @param Model|ModelBindings
 *
 * @return RecordCollection
 */
function fetch(Model $model, array $conditions)
{
    return $model->fetch_records($conditions;
}

要求

该包需要 PHP 7.2 或更高版本。

安装

composer require icanboogie/bind-facets

文档

该包作为 ICanBoogie 框架的一部分进行文档记录 文档。您可以使用 make doc 命令生成包及其依赖项的文档。文档生成在 build/docs 目录中。需要 ApiGen。您可以使用 make clean 命令清理该目录。

测试

运行 make test-container 创建并登录测试容器,然后运行 make test 运行测试套件。或者,运行 make test-coverage 使用测试覆盖率运行测试套件。打开 build/coverage/index.html 查看代码覆盖率分解。

许可证

icanboogie/bind-facets 根据 New BSD 许可证 发布。