protected function _before() { $svc = ContainerService::getInstance(); $config = new UserPackage(); $svc->registerToContainer($config); $container = $svc->getContainer(); $this->svc = $container['service.user']; }
protected function _before() { $db = new DbCredentials(); $package = new PersonPackage(); $containerService = ContainerService::getInstance(); $containerService->registerToContainer($db); $containerService->registerToContainer($package); $this->container = $containerService->getContainer(); }
protected function _before() { $creds = new DbCredentials(); $creds->setDatabase('expenses'); $package = new ExpensesPackage(); ContainerService::getInstance()->registerToContainer($package); ContainerService::getInstance()->setDbCredentials($creds); $container = ContainerService::getInstance()->getContainer(); $this->svc = $container['service.expenses']; }
public function testAddToContainer() { ContainerService::getInstance()->registerToContainer($this->creds); $creds = ContainerService::getInstance()->getContainer()['db.credentials']; $this->assertTrue(is_array($creds)); $this->assertArrayHasKey('driver', $creds); $this->assertArrayHasKey('dbname', $creds); $this->assertArrayHasKey('user', $creds); $this->assertArrayHasKey('password', $creds); }
protected function _before() { $credentials = new DbCredentials(); $container = ContainerService::getInstance()->setDbCredentials($credentials)->addEntityPath('src/Entity')->getContainer(); $em = $container['doctrine.entity_manager']; $helperSet = ConsoleRunner::createHelperSet($em); $helperSet->set(new DialogHelper(), 'dialog'); $this->app = new Application(); $gen = new GenerateProxy(); $gen->setHelperSet($helperSet); $this->app->add($gen); $this->app->add(new VersionCommand()); }
protected function _before() { $credentials = new DbCredentials(); $container = ContainerService::getInstance()->setDbCredentials($credentials)->addEntityPath('src/Entity')->getContainer(); $em = $container['doctrine.entity_manager']; $helperSet = ConsoleRunner::createHelperSet($em); $helperSet->set(new DialogHelper(), 'dialog'); $configuration = new Configuration($em->getConnection()); $configuration->setMigrationsNamespace('Migrations'); $configuration->setMigrationsTableName('Migration'); $this->app = new Application(); $mig = new Migration(); $mig->setMigrationConfiguration($configuration); $this->app->add($mig); $this->app->add(new VersionCommand()); }
public function init() { $this->container = ContainerService::getInstance()->getContainer(); }
protected function _before() { $this->containerSvc = ContainerService::getInstance(); }
//$diff->setMigrationConfiguration($configuration); //$exec->setMigrationConfiguration($configuration); //$gen->setMigrationConfiguration($configuration); //$migrate->setMigrationConfiguration($configuration); //$status->setMigrationConfiguration($configuration); //$ver->setMigrationConfiguration($configuration); // //$cli = ConsoleRunner::createApplication($helperSet,[ // $diff, $exec, $gen, $migrate, $status, $ver //]); // //return $cli->run(); use Del\Common\Command\Migration; use Doctrine\DBAL\Migrations\Configuration\Configuration; use Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand; use Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand; use Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand; use Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand; use Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand; use Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand; use Doctrine\ORM\Tools\Console\ConsoleRunner; use Del\Common\ContainerService; use Del\Common\Config\DbCredentials; $credentials = new DbCredentials(); $container = ContainerService::getInstance()->setDbCredentials($credentials)->addEntityPath('src/Entity')->getContainer(); /** @var Doctrine\ORM\EntityManager $em*/ $em = $container['doctrine.entity_manager']; $helperSet = ConsoleRunner::createHelperSet($em); $helperSet->set(new \Symfony\Component\Console\Helper\DialogHelper(), 'dialog'); $cli = ConsoleRunner::createApplication($helperSet, []); return $cli->run();
/** * @return PimpleContainer */ public static function getContainer() { return ContainerService::getInstance()->setDbCredentials(new DbCredentials())->addEntityPath('src/Entity')->getContainer(); }