2017 © Pedro Peláez
 

library doctrine2-exporter

MySQL Workbench Schema Exporter for Doctrine 2

image

fi/doctrine2-exporter

MySQL Workbench Schema Exporter for Doctrine 2

  • Wednesday, January 11, 2017
  • by manzolo
  • Repository
  • 2 Watchers
  • 0 Stars
  • 703 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

README

This is an exporter to convert MySQL Workbench Models (*.mwb) to a Doctrine 2 Schema., (*1)

Prerequisites

  • PHP 5.4+
  • Composer to install the dependencies

Installation

php composer.phar require --dev mysql-workbench-schema-exporter/doctrine2-exporter

This will install the exporter and also require mysql-workbench-schema-exporter., (*2)

You then can invoke the CLI script using vendor/bin/mysql-workbench-schema-export., (*3)

Formatter Setup Options

Additionally to the common options of mysql-workbench-schema-exporter these options are supported:, (*4)

Common Setup Options for Doctrine 2.0:, (*5)

  • useAutomaticRepository, (*6)

    Automatically generate entity repository class name., (*7)

  • bundleNamespace, (*8)

    The global namespace prefix for entity class name., (*9)

  • entityNamespace, (*10)

    The entity namespace., (*11)

    Default is Entity., (*12)

  • repositoryNamespace, (*13)

    The namespace prefix for entity repository class name. For this configuration to apply, useAutomaticRepository must be set to true., (*14)

  • skipColumnWithRelation, (*15)

    Don't generate columns definition (for YAML) or columns variable and columns getter and setter (for Annotation) which has relation to other table., (*16)

    Default is false., (*17)

  • relatedVarNameFormat, (*18)

    The format for generated related column name., (*19)

    Default is %name%%related%., (*20)

  • nullableAttribute, (*21)

    How nullable attribute of columns and joins is generated. Set to auto if you want to automatically include nullable attribute based on its value. Set to always to always include nullable attribute., (*22)

    Default is auto., (*23)

  • generatedValueStrategy, (*24)

    The stragety for auto-generated values., (*25)

    Default is auto., (*26)

  • defaultCascade, (*27)

    The default cascade option to define., (*28)

    Default is false., (*29)

Doctrine 2.0 YAML Schema

Setup Options

  • extendTableNameWithSchemaName, (*30)

    Include schema name beside the table name., (*31)

    Default is false., (*32)

Doctrine 2.0 Annotation

Setup Options

  • useAnnotationPrefix, (*33)

    Doctrine annotation prefix., (*34)

    Default is ORM\., (*35)

  • skipGetterAndSetter, (*36)

    Don't generate columns getter and setter., (*37)

    Default is false., (*38)

  • generateEntitySerialization, (*39)

    Generate method __sleep() to include only real columns when entity is serialized., (*40)

    Default is true., (*41)

  • generateExtendableEntity, (*42)

    Generate two class for each tables in schema, one for base and one other for extend class. The extend class would not be generated if it already exist. So it is safe to place custom code inside the extend class., (*43)

    This option will generate entity using Single Table Inheritance., (*44)

    Default is false., (*45)

  • quoteIdentifierStrategy, (*46)

    This option determine wheter identifier quoting is applied or not, depend on the strategy value., (*47)

    • auto, indentifier quoting enabled if identifier is a reserved word.
    • always, always quote identifier.
    • none, never quote identifier.

    Default is auto., (*48)

  • extendsClass, (*49)

    This option allows you to define a base class from which all generated entities extend., (*50)

    Default is ''., (*51)

  • propertyTypehint, (*52)

    This option allows you to specify whether type-hinting should be enabled for all non-scalar properties whose type is a class. E.g. \DateTime would be type-hinted but not object or string., (*53)

    Default is false., (*54)

Model Comment Behavior

  • {d:bundleNamespace}AcmeBundle{/d:bundleNamespace} (applied to Table), (*55)

    Override bundleNamespace option., (*56)

  • {d:m2m}false{/d:m2m} (applied to Table), (*57)

    MySQL Workbench Schema Exporter tries to automatically guess which tables are many-to-many mapping tables and will not generate entity classes for these tables., (*58)

    A table is considered a mapping table, if it contains exactly two foreign keys to different tables and those tables are not many-to-many mapping tables., (*59)

    Sometimes this guessing is incorrect for you. But you can add a hint in the comment of the table, to show that it is no mapping table. Just use {d:m2m}false{/d:m2m} anywhere in the comment of the table., (*60)

  • {d:unidirectional}true{/d:unidirectional} (applied to ForeignKey), (*61)

    All foreign keys will result in a bidirectional relation by default. If you only want a unidirectional relation, add a flag to the comment of the foreign key., (*62)

  • {d:owningSide}true{/d:owningSide} (applied to ForeignKey), (*63)

    In a bi-directional many-to-many mapping table the owning side of the relation is randomly selected. If you add this hint to one foreign key of the m2m-table, you can define the owning side for Doctrine., (*64)

  • {d:cascade}persist, merge, remove, detach, all{/d:cascade} (applied to ForeignKey), (*65)

    You can specify Doctrine cascade options as a comment on a foreign key. They will be generated into the Annotation. (Reference), (*66)

  • {d:fetch}EAGER{/d:fetch} (applied to ForeignKey), (*67)

    You can specify the fetch type for relations in the comment of a foreign key. (EAGER or LAZY, doctrine default is LAZY), (*68)

  • {d:orphanRemoval}true{/d:orphanRemoval} (applied to ForeignKey), (*69)

    Another option you can set in the comments of foreign key. (Reference), (*70)

  • {d:order}column{/d:order} (applied to ForeignKey), (*71)

    Apply OrderBy annotation to One To Many and Many To Many relation. OrderBy annotation can be written in the following format:, (*72)

    column[,(asc|desc)]

    Multiple columns are supported, separated by line break. Example usage:, (*73)

    {d:order}
      column1
      column1,desc
    {/d:order}

Doctrine 2.0 Annotation with ZF2 Input Filter Classes

Doctrine 2.0 Annotation with ZF2 Input Filter Classes formatter directly extend Doctrine 2.0 Annotation. The setup options and model comment behavior exactly the same as Doctrine 2.0 Annotation with the following addons., (*74)

Setup Options

  • generateEntityPopulate, (*75)

    Generate populate() method for entity class., (*76)

    Default is true., (*77)

  • generateEntityGetArrayCopy, (*78)

    Generate getArrayCopy() method for entity class., (*79)

    Default is true., (*80)

Command Line Interface (CLI)

See documentation for mysql-workbench-schema-exporter, (*81)

The Versions

11/01 2017

dev-master

9999999-dev https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter

MySQL Workbench Schema Exporter for Doctrine 2

  Sources   Download

MIT

The Requires

 

by Johannes Mueller
by Toha
by Robert Vock

database cli doctrine mysql mysql workbench

11/01 2017

3.0.1

3.0.1.0 https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter

MySQL Workbench Schema Exporter for Doctrine 2

  Sources   Download

MIT

The Requires

 

by Johannes Mueller
by Toha
by Robert Vock

database cli doctrine mysql mysql workbench

04/01 2016

3.0.0

3.0.0.0 https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter

MySQL Workbench Schema Exporter for Doctrine 2

  Sources   Download

MIT

The Requires

 

by Johannes Mueller
by Toha
by Robert Vock

database cli doctrine mysql mysql workbench