承接 strakez/entity-decorator-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

strakez/entity-decorator-api

最新稳定版本:v1.0.0-beta

Composer 安装命令:

composer require strakez/entity-decorator-api

包简介

Implements a decorator pattern to access and customize typed access to an entity's properties and methods

README 文档

README

Implements a decorator pattern to access and customize an entity's properties and methods, with the option to strongly type return values.

Installation

composer require strakez/drupal-entity-decorator

Requirements

  • PHP 8.1+
  • Drupal 10+

Purpose

Provides a simple means to retrieve and display entity data, and solves some of the challenges experienced when working with entities. This implementation of the decorator pattern wraps the entity and provides customized methods for interacting with the entity.

Please note, this only exposes classes for use in other modules and does not provide any Drupal functionality on its own. There will not be anything to display via the UI unless specifically implemented.

Usage

$id = 1;
$node = NodeDecorator::load($id); // Collection

$node->id(); // 1
$node->get('title'); // 'My First Node'
$node->get('sticky'); // false

For information on using and extending decorators, see the Decorator documentation.

For tips and best practices, see the Tips & Best Practices section.

Working with Collections

When loading multiple decorators at a time, the data will be representated in a collection. This provides an advantage over simple arrays, as this data can be easily sorted, mutated, counted, and indexed.

$set = NodeDecorator::loadByOwned($user); // Collection

For more information, see the Collection documentation.

Final Words

Please have fun using this API, and feel free to submit your comments and/or improvements if you find any. Thanks!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2024-01-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固