承接 itemvirtual/laravel-doctrine 相关项目开发

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

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

itemvirtual/laravel-doctrine

Composer 安装命令:

composer require itemvirtual/laravel-doctrine

包简介

Doctrine Console Commands for Laravel framework

README 文档

README

Latest Version on Packagist Total Downloads

Doctrine Console Commands for Laravel framework.
This package is just to keep your database in sync (instead of migrations).
Update, validate and generate xml-mappings from the database.

Installation

You can install the package via composer:

composer require itemvirtual/laravel-doctrine

In order to edit the default configuration you may execute: (with --force option to update)

php artisan vendor:publish --provider="Itemvirtual\LaravelDoctrine\LaravelDoctrineServiceProvider" --tag=config

Laravel comes with some predefined migrations, you can put them in place with this publish

php artisan vendor:publish --provider="Itemvirtual\LaravelDoctrine\LaravelDoctrineServiceProvider" --tag=laravel_default_migrations

Usage

· Generate xml-mappings from database

This command is only useful when you have an existing database, It should not be necessary for you to call this method multiple times

You can provide the destination path where the generated files will be saved.
You also have the option to only generate the mappings for certain tables.

php artisan doctrine:generate-mappings [--path=destination/path/to/xml-mappings] [--table=<table_name>]+
php artisan doctrine:generate-mappings --path=database/doctrine/xml-mappings --table=ursers --table=password_resets

Options:

  --path[=PATH]     The path where your xml-mapping files will be generated
  --table[=TABLE]   The database tables to be generated (multiple values allowed)

· Validate mappings and database

Check if the associations are defined correctly, and their mappings are in sync with the database.
You can remove all your entities before perform validating.

php artisan doctrine:validate [-R | --remove-entities]

Options:

  -R, --remove-entities  Delete current entities before generating new ones

· Update database

Run the queries to update your database or preview them without querying.
You can remove all of your entities before upgrading.
Every time you run this command, doctrine:generate-entities is called

php artisan doctrine:update [-D | --dump-sql] [-R | --remove-entities]
php artisan doctrine:update -DR

Options:

  -D, --dump-sql         Dumps generated SQL statements to the console (does not execute them)
  -R, --remove-entities  Delete current entities before generating new ones

· Cache clear

Sometimes you can get missing entity errors, deleting cached data can help to fix it.

php artisan doctrine:clear-cache [--flush]

# This command will run these three commands at once, you can run them separately if you want 
php artisan doctrine:clear-cache:metadata [--flush]
php artisan doctrine:clear-cache:query [--flush]
php artisan doctrine:clear-cache:result [--flush]

Options:

  --flush    If defined, cache entries will be flushed instead of deleted/invalidated

· Generate migrations (for testing)

For testing purposes, you will need your project migrations. You can generate it with the following command.
By default, they will be generated in tests/database/migrations

php artisan doctrine:migrations-generate [destination/path]
php artisan doctrine:migrations-generate --tables users,password_resets --ignore users,password_resets

Arguments:

  path    If defined, it will generate the files in the given path, by default

Options:

  -R, --remove                     Remove previous generated migration files
  -O, --output                     View migrations package console output
  -S, --single-file[=SINGLE-FILE]  Generate all migrations in a single file [default: "true"]
  -T, --tables[=TABLES]            A list of Tables or Views you wish to Generate Migrations separated by comma: users,products,labels
  -I, --ignore[=IGNORE]            A list of Tables or Views you wish to ignore, separated by comma: users,products,labels

Available commands for the "doctrine" namespace

  doctrine:clear-cache           Clear metadata, query and result cache of the various cache drivers
  doctrine:clear-cache:metadata  Clear all metadata cache of the various cache drivers
  doctrine:clear-cache:query     Clear all query cache of the various cache drivers
  doctrine:clear-cache:result    Clear all result cache of the various cache drivers
  doctrine:convert-mapping       Convert mapping information between supported formats
  doctrine:generate-entities     Generate entity classes and method stubs from your mapping information (xml-mappings)
  doctrine:generate-mappings     Generate xml-mappings from your database
  doctrine:remove-entities       Remove all entities
  doctrine:update                Update the database (or dump SQL) based on the entities information
  doctrine:validate              Validate mappings and synchronization with the database
  doctrine:migrations-generate   Generate laravel migration files from database 

You can see the arguments and options of each of them with the help command

php artisan -help <command>

utf8mb4

To change the character set and collation of a table, add this options to the entity

<options>
    <option name="collate">utf8mb4_unicode_ci</option>
    <option name="charset">utf8mb4</option>
</options>

Problems with mysql 5.7

mysql versions prior to 5.7.7 may throw an error "Specified key was too long; max key length is 767 bytes"
You must verify that any column of type string and unique=true must set its maximum length="190"

Important, check the indexes

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

Doctrine XML Mapping documentation and examples

Doctrine documentation Doctrine Types

itemvirtual/laravel-doctrine 适用场景与选型建议

itemvirtual/laravel-doctrine 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 263 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 04 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel-doctrine」 「itemvirtual」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 itemvirtual/laravel-doctrine 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 itemvirtual/laravel-doctrine 我们能提供哪些服务?
定制开发 / 二次开发

基于 itemvirtual/laravel-doctrine 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-21