定制 aeviiq/storage-manager 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

aeviiq/storage-manager

最新稳定版本:v6.1

Composer 安装命令:

composer require aeviiq/storage-manager

包简介

Storage Manager Component

README 文档

README

Why

To provide an easy way to store data with references to Doctrine entities, without storing the entities or their proxies themselves. A deep copy of the original object is made, in which any entity will be detached and have their identifiers stored with them. These will be used to retrieve a managed entity upon load().

The objects are saved as a copy, meaning referential changes will not affect the object that is stored. To persist any changes, save() the object. See example below.

Support for readonly properties

To copy an object, the StorageManager uses the DeepCopy component from MyClabs. This component does not yet have support for the newly introducted readonly properties in PHP 8.1.

They do have an open ticket to support this.

Installation

composer require aeviiq/storage-manager

Usage

final class Foo
{
    public function __construct(private readonly StorageManagerInterface $storageManager)
    {
    }
    
    public function __invoke(): void
    {
        $object = new stdClass();
        $object->foo = 'foo';
        
        $this->storageManager->save('some_key', $object);
        // These changes are made after the save() call and will not be there upon load().
        $object->foo = 'bar';
        
        $loadedObject = $this->storageManager->load('some_key');
        
        $object === $loadedObject; // false
        $loadedObject->foo === 'bar' // false
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固