Use abstract class

This commit is contained in:
Juan Pablo Vial
2024-12-22 11:02:21 -03:00
parent 01e6cef219
commit 21c593c93b

View File

@ -7,16 +7,24 @@ use PDOException;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Style\StyleInterface; use Symfony\Component\Console\Style\StyleInterface;
use ProVM\Concept; use ProVM\Concept;
use ProVM\Enforce;
use ProVM\Repository; use ProVM\Repository;
class Migration class Migration extends Enforce\Generator
{ {
public function __construct( public function __construct(
protected Concept\Database\Connection $connection, protected Concept\Database $database, protected Concept\Database $database,
protected Concept\Database\Connection $connection,
protected Concept\Database\Query\Builder $queryBuilder, protected Concept\Database\Query\Builder $queryBuilder,
public Repository\Table $tableRepository, protected LoggerInterface $logger, public Repository\Table $tableRepository,
protected DateTimeInterface $startDate, protected string $databaseName, LoggerInterface $logger,
protected string $migrationsPath, protected array $skips) {} protected DateTimeInterface $startDate,
protected string $databaseName,
protected string $migrationsPath,
protected array $skips)
{
parent::__construct($logger);
}
public function generate(StyleInterface $io, bool $dryRun = false): void public function generate(StyleInterface $io, bool $dryRun = false): void
{ {
@ -121,11 +129,4 @@ use Phinx\Db\Adapter\MysqlAdapter;
$time->format('Y-m-d H:i:s') $time->format('Y-m-d H:i:s')
]); ]);
} }
protected function log(string $message, bool $output = false, ?StyleInterface $io = null): void
{
$this->logger->info($message);
if ($output) {
$io->note($message);
}
}
} }