PHP code example of codito / doctrine-migrations-service-provider

1. Go to this page and download the library: Download codito/doctrine-migrations-service-provider library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codito / doctrine-migrations-service-provider example snippets


$app->register(new DoctrineServiceProvider(), array(
    'dbs.options' => array(
        'some_connection' => array(
            'driver'   => 'pdo_mysql',
            'dbname'   => 'silex',
            'host'     => 'localhost',
            'user'     => 'root',
            'password' => null,
            'port'     => null,
        )
    )
));

$app->register(new \Codito\Silex\Provider\ConsoleServiceProvider(), array(
    'console.name'              => 'Silex App',
    'console.version'           => '1.0.0',
));

$app->register(new \Codito\Silex\DoctrineMigrationsService\Provider\DoctrineMigrationsServiceProvider(), array(
    'db.migrations.options' => array(
        'some_connection' => array(
            'dir_name' => realpath(__DIR__ . '/Application/Migrations'),
            'namespace' => 'Application\\Migrations',
            'table_name' => 'migration_versions',
            'name' => 'Application Migrations',
        )
    )
));

$app->register(new Dflydev\Silex\Provider\DoctrineOrm\DoctrineOrmServiceProvider(), array(
    'orm.proxies_dir' => __DIR__ . '/../var/orm',
    'orm.ems.options' => array(
        'some_entity_manager' => array(
            'connection' => 'some_connection', // Important if you have custom connection name
            'mappings' => array(
                // Using actual filesystem paths
                array(
                    'type' => 'annotation',
                    'namespace' => 'Application\Entity',
                    'path' => __DIR__ . '/Application/Entity',
                    'use_simple_annotation_reader' => false // Support for "use Doctrine\ORM\Mapping AS ORM" -> "@ORM\Entity"
                ),
            ),
        )
    ),
));

$loader = Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));