Bundle to use Doctrator with Symfony2.
From the root of your Symfony project...
Install Mondongo, Doctrator & DoctratorBundle
$ git submodule git://github.com/pablodip/DoctratorBundle.git src/Lubo/DoctratorBundle
$ git submodule git://github.com/pablodip/doctrator.git vendor/doctrator
$ git submodule git://github.com/mondongo/mondongo.git vendor/mondongo
$ git submodule update --init
You can find this in autoload.php or perhaps your bootstrap.php file:
$loader->registerNamespaces(array(
...
'Lubo' => __DIR__.'/../src',
'Doctrator' => __DIR__.'/../vendor/doctrator/src',
'Mondongo' => __DIR__.'/../vendor/mondongo/src',
));
Just to make sure everything is loading properly...
$ php app/console doctrator:generate --help
Usage:
doctrator:generate
...
Recommended Reading: Mondator Documentation
DoctratorBundle will automatically parse these files:
- app/config/doctrator/*.yml
- Bundle/Resources/config/doctrator/*.yml
Here is an example:
# app/config/mondongo/schema.yml
Model\Article:
columns:
id: { id: auto, type: integer}
title: { type: string, length: 255 }
content: { type: string }
# DoctratorUserBundle/Resources/config/doctrator/schema.yml (note the bundle name in the namespace)
Model\DoctratorUserBundle\User:
columns:
id: { id: auto, type: integer }
username: { type: string, length: 20 }
password: { type: string, length: 40 }
$ php app/console doctrator:generate