diff --git a/app/bootstrap/app.php b/app/bootstrap/app.php new file mode 100644 index 0000000..a6423e0 --- /dev/null +++ b/app/bootstrap/app.php @@ -0,0 +1,32 @@ +isDir()) { + continue; + } + $builder->addDefinitions($file->getRealPath()); + } + } + + $app = (new ProVM\Extend\Application()) + ->setContainer($builder->build()); + return require_once 'commands.php'; +} + +require_once 'composer.php'; + +return buildApp(); diff --git a/app/bootstrap/commands.php b/app/bootstrap/commands.php new file mode 100644 index 0000000..9f47863 --- /dev/null +++ b/app/bootstrap/commands.php @@ -0,0 +1,9 @@ +getContainer()->get('commands'); + foreach ($commands as $commandClass) { + $app->add($app->getContainer()->get($commandClass)); + } + return $app; +} +return buildCommands($app); \ No newline at end of file diff --git a/app/bootstrap/composer.php b/app/bootstrap/composer.php new file mode 100644 index 0000000..f29699c --- /dev/null +++ b/app/bootstrap/composer.php @@ -0,0 +1,6 @@ + [ + ProVM\Command\GenerateMigrations::class, + ] +]; \ No newline at end of file diff --git a/app/configs/env.php b/app/configs/env.php new file mode 100644 index 0000000..721340d --- /dev/null +++ b/app/configs/env.php @@ -0,0 +1,13 @@ + '20141101080000', + 'skips' => [ + 'monolog', + 'phinxlog', + 'personas', + 'datos_personas', + 'proveedores', + 'datos_proveedores' + ] +]; \ No newline at end of file diff --git a/app/configs/paths.php b/app/configs/paths.php new file mode 100644 index 0000000..52a6e0e --- /dev/null +++ b/app/configs/paths.php @@ -0,0 +1,8 @@ + dirname(__DIR__), + 'paths.resources' => DI\String('{paths.base}/resources'), + 'paths.database' => DI\String('{paths.resources}/database'), + 'paths.migrations' => DI\String('{paths.database}/migrations'), + 'paths.seeds' => DI\String('{paths.database}/seeds') +]; \ No newline at end of file diff --git a/app/setups/concepts.php b/app/setups/concepts.php new file mode 100644 index 0000000..7ec4b2e --- /dev/null +++ b/app/setups/concepts.php @@ -0,0 +1,26 @@ + function(ContainerInterface $container) { + return (new ProVM\Database\MySQL()) + ->setHost($container->get('DB_HOST')) + ->setName($container->get('DB_DATABASE')) + ->setUser($container->get('DB_USER')) + ->setPassword($container->get('DB_PASSWORD')); + }, + ProVM\Concept\Database\Connection::class => function(ContainerInterface $container) { + return new ProVM\Database\Connection($container->get(ProVM\Concept\Database::class)); + }, + ProVM\Concept\Database\Query\Builder::class => function(ContainerInterface $container) { + return new ProVM\Database\Query\Builder([ + ProVM\Concept\Database\Query\Select::class => ProVM\Database\Query\MySQL\Select::class, + ProVM\Concept\Database\Query\Insert::class => ProVM\Database\Query\MySQL\Insert::class, + ProVM\Concept\Database\Query\Update::class => ProVM\Database\Query\MySQL\Update::class, + ProVM\Concept\Database\Query\Delete::class => ProVM\Database\Query\MySQL\Delete::class, + ProVM\Concept\Database\Query\Create::class => ProVM\Database\Query\MySQL\Create::class, + ProVM\Concept\Database\Query\Drop::class => ProVM\Database\Query\MySQL\Drop::class, + ProVM\Concept\Database\Query\Truncate::class => ProVM\Database\Query\MySQL\Truncate::class, + ]); + } +]; \ No newline at end of file diff --git a/app/setups/generators.php b/app/setups/generators.php new file mode 100644 index 0000000..5fd7702 --- /dev/null +++ b/app/setups/generators.php @@ -0,0 +1,18 @@ + function(ContainerInterface $container) { + return new ProVM\Generator\Migration( + $container->get(ProVM\Concept\Database\Connection::class), + $container->get(ProVM\Concept\Database::class), + $container->get(ProVM\Concept\Database\Query\Builder::class), + $container->get(ProVM\Repository\Table::class), + $container->get(Psr\Log\LoggerInterface::class), + new DateTimeImmutable($container->get('start_date')), + $container->get('DB_DATABASE'), + $container->get('paths.migrations'), + $container->get('skips') + ); + } +]; \ No newline at end of file diff --git a/app/setups/logs.php b/app/setups/logs.php new file mode 100644 index 0000000..a7eb285 --- /dev/null +++ b/app/setups/logs.php @@ -0,0 +1,16 @@ + function(ContainerInterface $container) { + return new Monolog\Logger('migrations', [ + (new Monolog\Handler\RotatingFileHandler('/logs/migrations.log')) + ->setFormatter(new Monolog\Formatter\LineFormatter(null, null, false, false, true)) + ], [ + $container->get(Monolog\Processor\IntrospectionProcessor::class), + $container->get(Monolog\Processor\MemoryUsageProcessor::class), + $container->get(Monolog\Processor\MemoryPeakUsageProcessor::class), + $container->get(Monolog\Processor\PsrLogMessageProcessor::class) + ]); + } +]; \ No newline at end of file diff --git a/app/setups/repositories.php b/app/setups/repositories.php new file mode 100644 index 0000000..2d30a9b --- /dev/null +++ b/app/setups/repositories.php @@ -0,0 +1,15 @@ + function(ContainerInterface $container) { + return new ProVM\Repository\Table( + $container->get(ProVM\Concept\Database\Connection::class), + $container->get('DB_DATABASE')); + }, + ProVM\Repository\Data::class => function(ContainerInterface $container) { + return new ProVM\Repository\Data( + $container->get(ProVM\Concept\Database\Connection::class), + $container->get(ProVM\Concept\Database\Query\Builder::class)); + } +]; \ No newline at end of file