定制 snoke/interface-associations 二次开发

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

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

snoke/interface-associations

最新稳定版本:0.0.2

Composer 安装命令:

composer require snoke/interface-associations

包简介

README 文档

README

Bundle for Symfony7 with Doctrine ORM

The Interface Associations Bundle provides a way to replace ORM relations with interfaces and map them to concrete classes at runtime. This enables the development of abstract components.

installation

run composer req snoke/interface-associations

Functionality

The bundle allows configuring remappings. You can specify which classes or interfaces should be replaced by other classes or interfaces, either globally or specifically for certain classes and properties.

configuration

edit config/packages/snoke_interface_associations.yaml as follows:

snoke_interface_associations:
    remap:
        - source: 'App\Interface\EntityInterface'
          target: 'App\Entity\User'
          class: 'App\Entity\AuthToken'
          field: 'user'
  • source: The source class or interface to be remapped.

  • target: The target class to remap to.

  • class (optional): The class where the remapping should be applied. If not specified, the remapping is global.

  • property (optional): The property within the class where the remapping should be applied. If not specified, the remapping applies to all properties of the class.

this way you can produce code having interfaces as relationships

    #[ORM\ManyToOne(inversedBy: 'accessTokens')]
    private EntityInterface $user;

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-12