| @@ 16-53 (lines=38) @@ | ||
| 13 | use Symfony\Component\Console\Input\InputInterface; |
|
| 14 | use Symfony\Component\Console\Output\OutputInterface; |
|
| 15 | ||
| 16 | class CreateSchemaCommand extends BaseCommand |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * CreateSchemaCommand constructor. |
|
| 20 | * |
|
| 21 | * @param array $parameters |
|
| 22 | */ |
|
| 23 | public function __construct(array $parameters) |
|
| 24 | { |
|
| 25 | parent::__construct( |
|
| 26 | 'iml_cache_create_schema', |
|
| 27 | 'pdo', |
|
| 28 | $parameters |
|
| 29 | ); |
|
| 30 | } |
|
| 31 | ||
| 32 | protected function configure() |
|
| 33 | { |
|
| 34 | $this |
|
| 35 | ->setName('iml:cache:schema:create') |
|
| 36 | ->setDescription('Create database schema.') |
|
| 37 | ->setHelp('This command creates the database schema (only with PDO driver).') |
|
| 38 | ; |
|
| 39 | } |
|
| 40 | ||
| 41 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 42 | { |
|
| 43 | $cache = $this->createClient($this->driver, $this->parameters); |
|
| 44 | ||
| 45 | try { |
|
| 46 | $cache->getRepository()->createSchema(); |
|
| 47 | ||
| 48 | $output->writeln('<fg=red>['.$this->driver.'] Schema was successful created.</>'); |
|
| 49 | } catch (\Exception $e) { |
|
| 50 | $output->writeln('<fg=red>['.$this->driver.'] Error in schema creation: '.$e->getMessage().' .</>'); |
|
| 51 | } |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| @@ 16-53 (lines=38) @@ | ||
| 13 | use Symfony\Component\Console\Input\InputInterface; |
|
| 14 | use Symfony\Component\Console\Output\OutputInterface; |
|
| 15 | ||
| 16 | class DestroySchemaCommand extends BaseCommand |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * CreateSchemaCommand constructor. |
|
| 20 | * |
|
| 21 | * @param array $parameters |
|
| 22 | */ |
|
| 23 | public function __construct(array $parameters) |
|
| 24 | { |
|
| 25 | parent::__construct( |
|
| 26 | 'iml_cache_destroy_schema', |
|
| 27 | 'pdo', |
|
| 28 | $parameters |
|
| 29 | ); |
|
| 30 | } |
|
| 31 | ||
| 32 | protected function configure() |
|
| 33 | { |
|
| 34 | $this |
|
| 35 | ->setName('iml:cache:schema:destroy') |
|
| 36 | ->setDescription('Destroys database schema.') |
|
| 37 | ->setHelp('This command destroys the database schema (only with PDO driver).') |
|
| 38 | ; |
|
| 39 | } |
|
| 40 | ||
| 41 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 42 | { |
|
| 43 | $cache = $this->createClient($this->driver, $this->parameters); |
|
| 44 | ||
| 45 | try { |
|
| 46 | $cache->getRepository()->destroySchema(); |
|
| 47 | ||
| 48 | $output->writeln('<fg=red>['.$this->driver.'] Schema was successful destroyed.</>'); |
|
| 49 | } catch (\Exception $e) { |
|
| 50 | $output->writeln('<fg=red>['.$this->driver.'] Error in schema destruction: '.$e->getMessage().' .</>'); |
|
| 51 | } |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||