Search by

sprimault / ormeau-doctrine

sprimault

Generates Doctrine entities from a legacy database and regenerates them without overwriting your code

Package info

github.com/sprimault/ormeau-doctrine

Homepage

Issues

Type:symfony-bundle

pkg:composer/sprimault/ormeau-doctrine

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 0

v0.7.0 2026-09-17 15:39 UTC

This package is auto-updated.

Last update: 2026-09-17 15:51:02 UTC


README

πŸ‡¬πŸ‡§ English Β· πŸ‡«πŸ‡· FranΓ§ais

ormeau-doctrine

The Symfony bundle of Ormeau: it generates Doctrine entities from a legacy database, and regenerates them six months later without discarding the code written on them since.

Doctrine removed doctrine:mapping:import, and nothing official replaced it. Ormeau takes over a real legacy database β€” T_ prefixes, foreign keys never declared, booleans stored as char(1) β€” and produces associations where a literal translation would leave integer columns.

Important

This repository is a read-only mirror of the php/ directory of sprimault/ormeau, rewritten on every merge. Issues, pull requests and documentation live in the main repository.

What it needs

The bundle does not read the database. It reads a logical layer produced by the ormeau binary, a single file to download from the releases, with nothing else to install. PostgreSQL or SQL Server, for instance:

$ ormeau extraire --dsn "postgres://app:secret@srv:5432/gescom" --sortie gescom.calque.json
$ ormeau inferer gescom.calque.json

ormeau inferer writes gescom.logique.json, and a decisions file where you settle what the tool cannot decide on its own.

Installation

$ composer require --dev sprimault/ormeau-doctrine
$ bin/console ormeau:generer gescom.logique.json

One database per entities directory: files name their database, and another database does not overwrite them without --remplacer=<base>. Only what prevents the requested generation returns 1: a file from another database, or an unreadable PHP file under the entities directory. Skipped entities and diverging classes return 0.

The whole workflow β€” extracting the layer, inferring, arbitrating, generating β€” is described in the main README, and what each version changes in the changelog.

Verification

The bundle's tests run under five combinations of PHP, Symfony, Doctrine ORM and DBAL, from PHP 8.1 with Symfony 5.4 and ORM 2.14 to PHP 8.4 with Symfony 8 and ORM 3, and the entities generated for every reference case pass the mapping validator of the installed ORM. On the binary side, integration tests run against a real database server, never a simulated catalog, and the extraction of the test database is compared byte for byte with a reference layer. The whole chain β€” extraction, generation, schema:create in an empty database β€” is replayed under ORM 3 and ORM 2.14, and the recreated database compared with the original: each remaining difference is listed with its reason.

CI only confirms: every change first goes through the same full validation, on Windows and Linux machines, before it is pushed.

Where the name comes from

Ormeau β€” pronounced roughly or-MOH β€” is French for a young elm, and for the abalone, a shellfish whose shell is built from stacked layers of nacre. It also happens to begin with ORM, which is convenient for a tool that produces ORM entities.

The pivot format is called a calque, in the tracing-paper sense: a faithful copy of the catalogue, with no interpretation. In linguistics a calque is a structural borrowing from one language into another β€” English skyscraper becoming French gratte-ciel. That is precisely the operation: carrying the structure of a relational schema over into another language's type system.

License

Apache 2.0 β€” see LICENSE. The entities Ormeau generates are yours: the licence covers the tool, not its output.