2017 © Pedro Peláez
 

library laravel-doctrine-mapping

image

n2boost/laravel-doctrine-mapping

  • Tuesday, July 17, 2018
  • by soniolabs
  • Repository
  • 2 Watchers
  • 1 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Generate Entities and Sync Database with Yml Config File

This package allows you to manage database scheme with yml orm config., (*1)

The orm config file just like this:, (*2)

Entity\User:
    type: entity
    table: user
    id:
        id:
            type: integer
            id: true
            generator:
                strategy: IDENTITY
    fields:
        username:
            type: string
            nullable: true
            length: 128
        password:
            type: string
            nullable: true

Installation

Laravel

This package can be used in Laravel 5.4 or higher., (*3)

You can install the package via composer:, (*4)

``` bash composer require n2boost/laravel-doctrine-mapping dev-master, (*5)


In Laravel 5.5 the service provider will automatically get registered. In older versions of the framework just add the service provider in `config/app.php` file: ```php 'providers' => [ // ... N2boost\LaravelDoctrineMapping\LaravelDoctrineMappingServiceProvider::class, ];

You can publish the config file with:, (*6)

php artisan vendor:publish --provider="N2boost\LaravelDoctrineMapping\LaravelDoctrineMappingServiceProvider::class" --tag="config"

If it doesn't works, please type:, (*7)

php artisan vendor:publish

And select the true number options., (*8)

When published, the config/laravel-doctrine-mapping.php config file contains:, (*9)

return [

    /*
     * Mapping Config Engines.
     * Can set to: yaml
     */

    'mapping_type' => 'yaml',

    /*
     * Mapping config files dir
     * full path will like this example: config/mappings/yaml/User.dcm.yml
     */
    'mapping_file_dir' => 'config/mappings',

    'entities_file_dir' => 'resources/classes',

    'profile' => 'local',
    'isDevMode' => true,

    'use_connection_pool' => 'laravel', // laravel, self
    'connection' => 'mysql',

    'connections' => [
        'mysql' => [
            'driver' => 'pdo_mysql',
            'host' => '127.0.0.1',
            'port' => 3306,
            'user' => 'root',
            'password' => '',
            'dbname' => 'hunter',
            'charset' => 'utf8mb4',
            'collate' => 'utf8mb4_unicode_ci',
        ]
    ]
];

If you use yaml config file engine, please install this dependence:, (*10)

composer require symfony/yaml

Usage

Config Yml-Orm

Generate Entities

php artisan n2boost:orm:generate-entities

Sync Database

php artisan n2boost:orm:scheme-tool:update

文档参考:, (*11)

Laravel 5.5 Package Development – Markus Tripp – Medium How to create a Laravel 5 package in 10 easy steps - Laravel Daily, (*12)

Design

Config file, (*13)

config/laravel-doctrine-mapping.php - 配置数据库连接 - 配置 mapping 文件目录 - 配置 entity 生成文件目录, (*14)

Command Lines, (*15)

  • php artisan n2boost:orm:generate-entities
  • php artisan n2boost:orm:scheme-tool:update

Tools, (*16)

composer remove symfony/yaml composer require symfony/yaml, (*17)

The Versions

17/07 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

10/07 2018

0.01

0.01.0.0

  Sources   Download

MIT

The Requires

 

10/07 2018

1.0.0-beta

1.0.0.0-beta

  Sources   Download

MIT

The Requires

 

10/07 2018

1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires