承接 fabiang/doctrine-dynamic 相关项目开发

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

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

fabiang/doctrine-dynamic

Composer 安装命令:

composer require fabiang/doctrine-dynamic

包简介

Load Doctrine mappings dynamically for your entities by configuration

README 文档

README

Proxy Driver for Doctrine which allows you to add custom relations dynamically by configuration.

This is useful if you use foreign entities, which you can't change, but you like to add own relations between them and your entities.

Latest Stable Version License
CI Scrutinizer Code Quality Code Coverage

Features

  • Setting all possible relations to entities:
    • OneToOne
    • ManyToOne
    • OneToMany
    • ManyToMany
  • Setting repository class

Installation

New to Composer? Read the introduction. Run the following Composer command:

$ composer require fabiang/doctrine-dynamic

Framework integration

Usage

<?php

use Fabiang\DoctrineDynamic\ConfigurationFactory;
use Fabiang\DoctrineDynamic\ProxyDriverFactory;
use Doctrine\ORM\EntityManager;

$configurationFactory = new ConfigurationFactory();
$configuration = $configurationFactory->factory([
    \Mymodule\Entity\Customer::class => [
        'options' => [
            'repository' => \Mymodule\Repository\CustomerRepository::class,
        ],
        'fields' => [
            'fieldname' => [
                'products' => [
                    'oneToMany' => [
                        [
                            'targetEntity' => \Mymodule\Entity\Customer::class,
                            'mappedBy'     => 'customer',
                        ],
                    ]
                ],
            ]
        ]
    ],
    \Mymodule\Entity\Products::class => [
        'fields' => [
            'customer' => [
                'manyToOne' => [
                    [
                        'targetEntity' => \Mymodule\Entity\Products::class,
                        'inversedBy'   => 'products',
                        'joinColumns'  => [
                            'name'                 => 'customer_id',
                            'referencedColumnName' => 'id'
                        ]
                    ],
                ]
            ],
        ]
    ],
]);

/** @var $entityManager EntityManager */
// get it from a container for example
$entityManager = $container->get(EntityManager::class);

$proxyDriverFactory = new ProxyDriverFactory();
$proxyDriverFactory->factory($entityManager, $configuration);

Development

This library is tested with PHPUnit and Behat.

Fork the project on Github and send an pull request with your changes. Make sure you didn't break anything with running the following commands:

composer install
./vendor/bin/phpunit
./vendor/bin/behat

Licence

BSD-2-Clause. See the LICENSE.md.

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2016-10-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固