Skip to content

Instantly share code, notes, and snippets.

@makr0
Last active August 29, 2015 13:57
Show Gist options
  • Save makr0/9691077 to your computer and use it in GitHub Desktop.
Save makr0/9691077 to your computer and use it in GitHub Desktop.
Silex: Doctrine Model from Database

in composer.json

"autoload": {
    "classmap": [ "model" ]
}    

in index.php

// ORM initialisieren
$app->register(new DoctrineOrmServiceProvider, array(
    "orm.proxies_dir" => "model/proxies",
    "orm.em.options" => array(
        "mappings" => array(
            // Using actual filesystem paths
            array(
                "type" => "yml",
                "namespace" => "tda\\",
                "path" => $bootstrap['fsroot']."/model/",
            ),
        ),
    ),
));

console

composer dump-autoload
vendor/bin/doctrine orm:convert-mapping --from-database --namespace="tda\\" yml model
vendor/bin/doctrine orm:generate-entities model/
vendor/bin/doctrine orm:generate-proxies model/proxies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment