fabiang/doctrine-dynamic-laminas

Laminas 绑定 for doctrine-dynamic

v2.0.0 2022-05-16 09:02 UTC

This package is auto-updated.

Last update: 2024-09-16 14:01:59 UTC


README

Laminas 绑定 for fabiang/doctrine-dynamic.

Latest Stable Version PHP Version Require License
Unit Tests Static Code Analysis Scrutinizer Code Quality Code Coverage

安装

新用户Composer?阅读介绍。运行以下Composer命令

$ composer require fabiang/doctrine-dynamic-laminas

配置

通过将其添加到config/application.config.php来加载模块

return [
    'modules' => [
        /** **/
        'Fabiang\DoctrineDynamic',
    ],
];

将额外的选项和关联配置到模块配置中(例如config/module.config.php

<?php

namespace Mymodule;

return [
    /** **/
    'doctrine_dynamic' => [
        \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'
                            ]
                        ]
                    ]
                ]
            ]
        ],
    ]
];

开发

此库使用 PHPUnit 进行测试。

在 Github 上fork该项目并提交带有您更改的pull request。确保您没有在运行以下命令时破坏任何内容

composer install
./vendor/bin/phpunit

许可证

BSD-2-Clause。查看LICENSE.md