PHPackages                             fi/doctrine2-exporter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. fi/doctrine2-exporter

Abandoned → [mysql-workbench-schema-exporter/doctrine2-exporter](/?search=mysql-workbench-schema-exporter%2Fdoctrine2-exporter)Library[Database &amp; ORM](/categories/database)

fi/doctrine2-exporter
=====================

MySQL Workbench Schema Exporter for Doctrine 2

4.0.1(4y ago)0705MITPHPPHP &gt;=5.4.0

Since Jan 4Pushed 4y agoCompare

[ Source](https://github.com/ComuneFI/doctrine2-exporter)[ Packagist](https://packagist.org/packages/fi/doctrine2-exporter)[ Docs](https://github.com/comunedifirenze/doctrine2-exporter)[ RSS](/packages/fi-doctrine2-exporter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (20)Used By (0)

README
======

[](#readme)

This is an exporter to convert [MySQL Workbench](http://www.mysql.com/products/workbench/) Models (\*.mwb) to a Doctrine 2 Schema.

Prerequisites
-------------

[](#prerequisites)

- PHP 5.4+
- Composer to install the dependencies

Installation
------------

[](#installation)

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

```

This will install the exporter and also require [mysql-workbench-schema-exporter](https://github.com/mysql-workbench-schema-exporter/mysql-workbench-schema-exporter).

You then can invoke the CLI script using `vendor/bin/mysql-workbench-schema-export`.

Formatter Setup Options
-----------------------

[](#formatter-setup-options)

Additionally to the [common options](https://github.com/mysql-workbench-schema-exporter/mysql-workbench-schema-exporter#configuring-mysql-workbench-schema-exporter) of mysql-workbench-schema-exporter these options are supported:

Common Setup Options for Doctrine 2.0:

- `useAutomaticRepository`

    Automatically generate entity repository class name.
- `bundleNamespace`

    The global namespace prefix for entity class name.
- `entityNamespace`

    The entity namespace.

    Default is `Entity`.
- `repositoryNamespace`

    The namespace prefix for entity repository class name. For this configuration to apply, `useAutomaticRepository` must be set to `true`.
- `skipColumnWithRelation`

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

    Default is `false`.
- `relatedVarNameFormat`

    The format for generated related column name.

    Default is `%name%%related%`.
- `nullableAttribute`

    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.

    Default is `auto`.
- `generatedValueStrategy`

    The stragety for auto-generated values.

    Default is `auto`.
- `defaultCascade`

    The default cascade option to define.

    Default is `false`.

### Doctrine 2.0 YAML Schema

[](#doctrine-20-yaml-schema)

#### Setup Options

[](#setup-options)

- `extendTableNameWithSchemaName`

    Include schema name beside the table name.

    Default is `false`.

### Doctrine 2.0 Annotation

[](#doctrine-20-annotation)

#### Setup Options

[](#setup-options-1)

- `useAnnotationPrefix`

    Doctrine annotation prefix.

    Default is `ORM\`.
- `skipGetterAndSetter`

    Don't generate columns getter and setter.

    Default is `false`.
- `generateEntitySerialization`

    Generate method `__sleep()` to include only real columns when entity is serialized.

    Default is `true`.
- `generateExtendableEntity`

    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.

    This option will generate entity using Single Table Inheritance.

    Default is `false`.
- `quoteIdentifierStrategy`

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

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

    Default is `auto`.
- `extendsClass`

    This option allows you to define a base class from which all generated entities extend.

    Default is `''`.
- `propertyTypehint`

    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`.

    Default is `false`.

#### Model Comment Behavior

[](#model-comment-behavior)

- `{d:bundleNamespace}AcmeBundle{/d:bundleNamespace}` (applied to Table)

    Override `bundleNamespace` option.
- `{d:m2m}false{/d:m2m}` (applied to Table)

    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.

    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.

    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.
- `{d:unidirectional}true{/d:unidirectional}` (applied to ForeignKey)

    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.
- `{d:owningSide}true{/d:owningSide}` (applied to ForeignKey)

    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.
- `{d:cascade}persist, merge, remove, detach, all{/d:cascade}` (applied to ForeignKey)

    You can specify Doctrine cascade options as a comment on a foreign key. They will be generated into the Annotation. ([Reference](http://doctrine-orm.readthedocs.org/en/latest/reference/working-with-associations.html#transitive-persistence-cascade-operations))
- `{d:fetch}EAGER{/d:fetch}` (applied to ForeignKey)

    You can specify the fetch type for relations in the comment of a foreign key. (EAGER or LAZY, doctrine default is LAZY)
- `{d:orphanRemoval}true{/d:orphanRemoval}` (applied to ForeignKey)

    Another option you can set in the comments of foreign key. ([Reference](http://doctrine-orm.readthedocs.org/en/latest/reference/working-with-associations.html#orphan-removal))
- `{d:order}column{/d:order}` (applied to ForeignKey)

    Apply OrderBy annotation to One To Many and Many To Many relation. OrderBy annotation can be written in the following format:

    ```
    column[,(asc|desc)]

    ```

    Multiple columns are supported, separated by line break. Example usage:

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

    ```

### Doctrine 2.0 Annotation with ZF2 Input Filter Classes

[](#doctrine-20-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.

#### Setup Options

[](#setup-options-2)

- `generateEntityPopulate`

    Generate `populate()` method for entity class.

    Default is `true`.
- `generateEntityGetArrayCopy`

    Generate `getArrayCopy()` method for entity class.

    Default is `true`.

Command Line Interface (CLI)
----------------------------

[](#command-line-interface-cli)

See documentation for [mysql-workbench-schema-exporter](https://github.com/mysql-workbench-schema-exporter/mysql-workbench-schema-exporter#command-line-interface-cli)

Links
-----

[](#links)

- [MySQL Workbench](http://wb.mysql.com/)
- [Doctrine Project](http://www.doctrine-project.org/)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~131 days

Recently: every ~0 days

Total

17

Last Release

1683d ago

Major Versions

1.0.1 → 4.x-dev2021-09-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/c06b49229d24051e9fe509791b9606e70bc5757d6d395a2c241350e2e2133a91?d=identicon)[comunefi\_spa](/maintainers/comunefi_spa)

---

Top Contributors

[![tohenk](https://avatars.githubusercontent.com/u/350747?v=4)](https://github.com/tohenk "tohenk (76 commits)")[![johmue](https://avatars.githubusercontent.com/u/281784?v=4)](https://github.com/johmue "johmue (66 commits)")[![DamienHarper](https://avatars.githubusercontent.com/u/2448660?v=4)](https://github.com/DamienHarper "DamienHarper (17 commits)")[![rvock](https://avatars.githubusercontent.com/u/209159?v=4)](https://github.com/rvock "rvock (17 commits)")[![adrianbardan](https://avatars.githubusercontent.com/u/2693350?v=4)](https://github.com/adrianbardan "adrianbardan (6 commits)")[![doncem](https://avatars.githubusercontent.com/u/1420191?v=4)](https://github.com/doncem "doncem (5 commits)")[![defyasdf](https://avatars.githubusercontent.com/u/1632536?v=4)](https://github.com/defyasdf "defyasdf (5 commits)")[![Yoda-BZH](https://avatars.githubusercontent.com/u/751889?v=4)](https://github.com/Yoda-BZH "Yoda-BZH (3 commits)")[![s2x](https://avatars.githubusercontent.com/u/196585?v=4)](https://github.com/s2x "s2x (2 commits)")[![meven](https://avatars.githubusercontent.com/u/620941?v=4)](https://github.com/meven "meven (2 commits)")[![HobieCat](https://avatars.githubusercontent.com/u/4680160?v=4)](https://github.com/HobieCat "HobieCat (1 commits)")[![leocavalcante](https://avatars.githubusercontent.com/u/183722?v=4)](https://github.com/leocavalcante "leocavalcante (1 commits)")[![allansun](https://avatars.githubusercontent.com/u/20531?v=4)](https://github.com/allansun "allansun (1 commits)")[![verticka](https://avatars.githubusercontent.com/u/391828?v=4)](https://github.com/verticka "verticka (1 commits)")[![drymek](https://avatars.githubusercontent.com/u/492240?v=4)](https://github.com/drymek "drymek (1 commits)")

---

Tags

clidatabasemysqldoctrinemysql workbench

### Embed Badge

![Health badge](/badges/fi-doctrine2-exporter/health.svg)

```
[![Health](https://phpackages.com/badges/fi-doctrine2-exporter/health.svg)](https://phpackages.com/packages/fi-doctrine2-exporter)
```

###  Alternatives

[mysql-workbench-schema-exporter/mysql-workbench-schema-exporter

MySQL Workbench Schema Exporter

488188.5k10](/packages/mysql-workbench-schema-exporter-mysql-workbench-schema-exporter)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58523.9M35](/packages/scienta-doctrine-json-functions)[mysql-workbench-schema-exporter/doctrine2-exporter

MySQL Workbench Schema Exporter for Doctrine 2

25143.3k2](/packages/mysql-workbench-schema-exporter-doctrine2-exporter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
