Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethink configuration to make a lot easier to define own handlers #78

Open
hrach opened this issue Sep 24, 2017 · 1 comment
Open

Rethink configuration to make a lot easier to define own handlers #78

hrach opened this issue Sep 24, 2017 · 1 comment

Comments

@hrach
Copy link
Member

hrach commented Sep 24, 2017

d46cbd6#commitcomment-24528344

@hrach
Copy link
Member Author

hrach commented Sep 24, 2017

Current sad sollution:

extensions:
	nextras.migrations: Nextras\Migrations\Bridges\NetteDI\MigrationsExtension

services:
	nextras.migrations.configuration:
		factory: MigrationConfiguration
		arguments:
			- %appDir%/../migrations
			- @Nextras\Migrations\IDriver
			- false
			- []
			- @Nette\DI\Container

nextras.migrations:
	dir: %appDir%/../migrations
	driver: pgsql
	dbal: nextras
<?php declare(strict_types = 1);

use Nette\DI\Container;
use Nextras\Migrations\Configurations\DefaultConfiguration;
use Nextras\Migrations\IDriver;


class MigrationConfiguration extends DefaultConfiguration
{
	/** @var Container */
	private $container;


	public function __construct($dir, IDriver $driver, $withDummyData = true, array $phpParams = [], Container $container)
	{
		parent::__construct($dir, $driver, $withDummyData, $phpParams);
		$this->container = $container;
	}


	public function getExtensionHandlers()
	{
		$handlers = parent::getExtensionHandlers();
		$handlers['php'] = $this->container->getByType(ConnectionPhpHandler::class);
		return $handlers;
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant