定制 vasildakov/mezzio-doctrine 二次开发

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

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

vasildakov/mezzio-doctrine

最新稳定版本:1.0.5

Composer 安装命令:

composer require vasildakov/mezzio-doctrine

包简介

Doctrine ORM integration for Mezzio

README 文档

README

build Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Synopsis

Doctrine ORM integration for Mezzio. This package provides integration with Doctrine ORM 3.x, Doctrine Migrations, and Doctrine Fixtures.

Installation

Install package via composer

composer require vasildakov/mezzio-doctrine

Configuration

Include the ConfigProvider in your config aggregator:

<?php
// In your config/config.php

$aggregator = new ConfigAggregator([
    // ...
    // Default App module config
    App\ConfigProvider::class,
    VasilDakov\Doctrine\ConfigProvider::class,
    // ...
]);

Example Configuration

<?php
declare(strict_types=1);

use Doctrine\DBAL\Driver\PDO\MySQL\Driver;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;

return [
    'doctrine' => [
        'connection' => [
            'orm_default' => [
                'driver_class' => Driver::class,
                'params' => [
                    'host'     => 'localhost',
                    'port'     => '3306',
                    'user'     => 'root',
                    'password' => 'root',
                    'dbname'   => 'database',
                ],
            ],
        ],
        
        'driver' => [
            'orm_default' => [
                'drivers' => [
                    'App\Entity' => [
                        'class' => AnnotationDriver::class,
                        'paths' => [
                            'src/Entity',
                        ],
                    ],
                ],
            ],
        ],
    ],
];

Doctrine ORM Commands

orm:clear-cache:metadata                   Clear all metadata cache of the various cache drivers
orm:clear-cache:query                      Clear all query cache of the various cache drivers
orm:clear-cache:result                     Clear all result cache of the various cache drivers
orm:generate-proxies                       [orm:generate:proxies] Generates proxy classes for entity classes
orm:run-dql                                Executes arbitrary DQL directly from the command line
orm:schema-tool:create                     Processes the schema and either create it directly on EntityManager Storage Connection or generate the SQL output
orm:schema-tool:drop                       Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output
orm:schema-tool:update                     Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata
orm:validate-schema                        Validate the mapping files

Migrations Commands

Commands uses Laminas CLI and vendor/bin/laminas entry point for it

Possible commands

doctrine:migrations:diff         [diff] Generate a migration by comparing your current database to your mapping information.
doctrine:migrations:dump-schema  [dump-schema] Dump the schema for your database to a migration.
doctrine:migrations:execute      [execute] Execute a single migration version up or down manually.
doctrine:migrations:generate     [generate] Generate a blank migration class.
doctrine:migrations:latest       [latest] Outputs the latest version number
doctrine:migrations:migrate      [migrate] Execute a migration to a specified version or the latest available version.
doctrine:migrations:rollup       [rollup] Rollup migrations by deleting all tracked versions and insert the one version that exists.
doctrine:migrations:status       [status] View the status of a set of migrations.
doctrine:migrations:up-to-date   [up-to-date] Tells you if your schema is up-to-date.
doctrine:migrations:version      [version] Manually add and delete migration versions from the version table.

Example

$ vendor/bin/laminas doctrine:migrations:diff
$ vendor/bin/laminas doctrine:migrations:migrate

Doctrine Fixtures Commands

doctrine:fixtures:load                     Load data fixtures

Tests

Run the tests with code coverage

XDEBUG_MODE=coverage vendor/bin/phpunit 

Author

Vasil Dakov - vasildakov@gmail.com - https://vasildakov.com

License

Package is licensed under the MIT License - see the LICENSE file for details

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固