PHP code example of kekos / doctrine-console-factory

1. Go to this page and download the library: Download kekos/doctrine-console-factory 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/ */

    

kekos / doctrine-console-factory example snippets



// Pseudo container
$container->set('doctrine.migrations', [
    'migrations_paths' => [
        'App\\Migrations' => __DIR__ . '/src/Migrations',
    ],
]);

$container->set(
    Doctrine\Migrations\Configuration\Migration\ConfigurationLoader::class,
    function($container) {
        $settings = $container->get('doctrine.migrations');

        return new Kekos\DoctrineConsoleFactory\MigrationsConfigurationLoader($settings);
    }
);


$console_app = new Symfony\Component\Console\Application('App', '1.0.0');

// Please let your DI container create the command factory instead!
$doctrine_command_factory = new Kekos\DoctrineConsoleFactory\DoctrineCommandFactory(
    $entity_manager,
    $configuration_loader
);
$doctrine_command_factory->addCommands($console_app);

$console_app->run();