frontastic/data-object 问题修复 & 功能扩展

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

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

frontastic/data-object

最新稳定版本:v1.0.0

Composer 安装命令:

composer require frontastic/data-object

包简介

Simple base class for data objects.

README 文档

README

Travis Build Status

This repository just contains a simple base class for PHP data objects.

This class throws exceptions if you try to read or write unknown properties, and ensures a clone is performed recursively.

Usage

To use this data object base class for your own data objects, just use something like this:

class Person extends \Kore\DataObject\DataObject
{
    public $prename;

    public $forename;
}

If you now access unknown properties you will get exceptions. For more details on the motivation behind this, read: http://qafoo.com/blog/016_struct_classes_in_php.html

In some cases it might be necessary that additional attributes can be passed while construction and are knowingly ignored and not added to the DataObject. Therefore a constructor parameter $ignoreAdditionalAttributes has been added, which is set to true by default. This will allow to create a DataObject of an array with more values where the additional values will be ignored and no exception will be thrown during construction. If you later try to access a property which is not existing though, an exception will be raised! On the other hand, if it's set to false it will throw an exception if you pass a value that doesn't match any property on the object.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-07