@@ -58,8 +58,7 @@ |
||
58 | 58 | * class MigrationServiceProvider |
59 | 59 | * @package Platine\Framework\Service\Provider |
60 | 60 | */ |
61 | -class MigrationServiceProvider extends ServiceProvider |
|
62 | -{ |
|
61 | +class MigrationServiceProvider extends ServiceProvider { |
|
63 | 62 | |
64 | 63 | /** |
65 | 64 | * {@inheritdoc} |
@@ -11,15 +11,13 @@ |
||
11 | 11 | * |
12 | 12 | * @author tony |
13 | 13 | */ |
14 | -class UserRepository extends Repository |
|
15 | -{ |
|
14 | +class UserRepository extends Repository { |
|
16 | 15 | |
17 | 16 | /** |
18 | 17 | * Create new instance |
19 | 18 | * @param EntityManager $manager |
20 | 19 | */ |
21 | - public function __construct(EntityManager $manager) |
|
22 | - { |
|
20 | + public function __construct(EntityManager $manager) { |
|
23 | 21 | parent::__construct($manager, User::class); |
24 | 22 | } |
25 | 23 | } |
@@ -67,8 +67,7 @@ |
||
67 | 67 | * class AbstractCommand |
68 | 68 | * @package Platine\Framework\Migration\Command |
69 | 69 | */ |
70 | -abstract class AbstractCommand extends Command |
|
71 | -{ |
|
70 | +abstract class AbstractCommand extends Command { |
|
72 | 71 | |
73 | 72 | /** |
74 | 73 | * The migration repository |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | protected function getExecuted(string $orderDir = 'ASC'): array |
215 | 215 | { |
216 | 216 | $migrations = $this->repository |
217 | - ->query() |
|
218 | - ->orderBy('version', $orderDir) |
|
219 | - ->all(); |
|
217 | + ->query() |
|
218 | + ->orderBy('version', $orderDir) |
|
219 | + ->all(); |
|
220 | 220 | $result = []; |
221 | 221 | |
222 | 222 | foreach ($migrations as $entity) { |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | protected function getMigrationClassName(string $description, string $version): string |
236 | 236 | { |
237 | 237 | return Str::camel($description, false) |
238 | - . Str::replaceFirst('_', '', $version); |
|
238 | + . Str::replaceFirst('_', '', $version); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -159,26 +159,3 @@ |
||
159 | 159 | private function getTemplateClass(): string |
160 | 160 | { |
161 | 161 | return <<<EOF |
162 | - <?php |
|
163 | - namespace Platine\Framework\Migration; |
|
164 | - |
|
165 | - use Platine\Framework\Migration\AbstractMigration; |
|
166 | - |
|
167 | - class %classname% extends AbstractMigration |
|
168 | - { |
|
169 | - |
|
170 | - public function up(): void |
|
171 | - { |
|
172 | - //Action when migrate up |
|
173 | - |
|
174 | - } |
|
175 | - |
|
176 | - public function down(): void |
|
177 | - { |
|
178 | - //Action when migrate down |
|
179 | - |
|
180 | - } |
|
181 | - } |
|
182 | - EOF; |
|
183 | - } |
|
184 | -} |
@@ -159,26 +159,3 @@ |
||
159 | 159 | private function getTemplateClass(): string |
160 | 160 | { |
161 | 161 | return <<<EOF |
162 | - <?php |
|
163 | - namespace Platine\Framework\Migration; |
|
164 | - |
|
165 | - use Platine\Framework\Migration\AbstractMigration; |
|
166 | - |
|
167 | - class %classname% extends AbstractMigration |
|
168 | - { |
|
169 | - |
|
170 | - public function up(): void |
|
171 | - { |
|
172 | - //Action when migrate up |
|
173 | - |
|
174 | - } |
|
175 | - |
|
176 | - public function down(): void |
|
177 | - { |
|
178 | - //Action when migrate down |
|
179 | - |
|
180 | - } |
|
181 | - } |
|
182 | - EOF; |
|
183 | - } |
|
184 | -} |
@@ -159,26 +159,3 @@ |
||
159 | 159 | private function getTemplateClass(): string |
160 | 160 | { |
161 | 161 | return <<<EOF |
162 | - <?php |
|
163 | - namespace Platine\Framework\Migration; |
|
164 | - |
|
165 | - use Platine\Framework\Migration\AbstractMigration; |
|
166 | - |
|
167 | - class %classname% extends AbstractMigration |
|
168 | - { |
|
169 | - |
|
170 | - public function up(): void |
|
171 | - { |
|
172 | - //Action when migrate up |
|
173 | - |
|
174 | - } |
|
175 | - |
|
176 | - public function down(): void |
|
177 | - { |
|
178 | - //Action when migrate down |
|
179 | - |
|
180 | - } |
|
181 | - } |
|
182 | - EOF; |
|
183 | - } |
|
184 | -} |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | * class MigrationCreateCommand |
61 | 61 | * @package Platine\Framework\Migration\Command |
62 | 62 | */ |
63 | -class MigrationCreateCommand extends AbstractCommand |
|
64 | -{ |
|
63 | +class MigrationCreateCommand extends AbstractCommand { |
|
65 | 64 | |
66 | 65 | /** |
67 | 66 | * The migration name |
@@ -88,8 +87,7 @@ discard block |
||
88 | 87 | /** |
89 | 88 | * {@inheritodc} |
90 | 89 | */ |
91 | - public function execute() |
|
92 | - { |
|
90 | + public function execute() { |
|
93 | 91 | $writer = $this->io()->writer(); |
94 | 92 | |
95 | 93 | $version = date('Ymd_His'); |
@@ -155,26 +153,3 @@ discard block |
||
155 | 153 | private function getTemplateClass(): string |
156 | 154 | { |
157 | 155 | return <<<EOF |
158 | - <?php |
|
159 | - namespace Platine\Framework\Migration; |
|
160 | - |
|
161 | - use Platine\Framework\Migration\AbstractMigration; |
|
162 | - |
|
163 | - class %classname% extends AbstractMigration |
|
164 | - { |
|
165 | - |
|
166 | - public function up(): void |
|
167 | - { |
|
168 | - //Action when migrate up |
|
169 | - |
|
170 | - } |
|
171 | - |
|
172 | - public function down(): void |
|
173 | - { |
|
174 | - //Action when migrate down |
|
175 | - |
|
176 | - } |
|
177 | - } |
|
178 | - EOF; |
|
179 | - } |
|
180 | -} |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | ) { |
81 | 81 | parent::__construct($app, $repository, $config, $filesystem); |
82 | 82 | $this->setName('migration:create') |
83 | - ->setDescription('Create a new migration'); |
|
83 | + ->setDescription('Create a new migration'); |
|
84 | 84 | |
85 | 85 | $this->addArgument('name', 'name of migration', null, false, true); |
86 | 86 | } |
@@ -158,26 +158,3 @@ discard block |
||
158 | 158 | private function getTemplateClass(): string |
159 | 159 | { |
160 | 160 | return <<<EOF |
161 | - <?php |
|
162 | - namespace Platine\Framework\Migration; |
|
163 | - |
|
164 | - use Platine\Framework\Migration\AbstractMigration; |
|
165 | - |
|
166 | - class %classname% extends AbstractMigration |
|
167 | - { |
|
168 | - |
|
169 | - public function up(): void |
|
170 | - { |
|
171 | - //Action when migrate up |
|
172 | - |
|
173 | - } |
|
174 | - |
|
175 | - public function down(): void |
|
176 | - { |
|
177 | - //Action when migrate down |
|
178 | - |
|
179 | - } |
|
180 | - } |
|
181 | - EOF; |
|
182 | - } |
|
183 | -} |
@@ -57,8 +57,7 @@ discard block |
||
57 | 57 | * class MigrationMigrateCommand |
58 | 58 | * @package Platine\Framework\Migration\Command |
59 | 59 | */ |
60 | -class MigrationMigrateCommand extends AbstractCommand |
|
61 | -{ |
|
60 | +class MigrationMigrateCommand extends AbstractCommand { |
|
62 | 61 | |
63 | 62 | /** |
64 | 63 | * Create new instance |
@@ -79,8 +78,7 @@ discard block |
||
79 | 78 | /** |
80 | 79 | * {@inheritodc} |
81 | 80 | */ |
82 | - public function execute() |
|
83 | - { |
|
81 | + public function execute() { |
|
84 | 82 | $io = $this->io(); |
85 | 83 | $writer = $io->writer(); |
86 | 84 | $writer->boldYellow('MIGRATION UPGRADE TO LATEST', true)->eol(); |
@@ -71,7 +71,7 @@ |
||
71 | 71 | ) { |
72 | 72 | parent::__construct($app, $repository, $config, $filesystem); |
73 | 73 | $this->setName('migration:migrate') |
74 | - ->setDescription('Upgrade migration to latest'); |
|
74 | + ->setDescription('Upgrade migration to latest'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -58,8 +58,7 @@ discard block |
||
58 | 58 | * class MigrationStatusCommand |
59 | 59 | * @package Platine\Framework\Migration\Command |
60 | 60 | */ |
61 | -class MigrationStatusCommand extends AbstractCommand |
|
62 | -{ |
|
61 | +class MigrationStatusCommand extends AbstractCommand { |
|
63 | 62 | |
64 | 63 | /** |
65 | 64 | * Create new instance |
@@ -80,8 +79,7 @@ discard block |
||
80 | 79 | /** |
81 | 80 | * {@inheritodc} |
82 | 81 | */ |
83 | - public function execute() |
|
84 | - { |
|
82 | + public function execute() { |
|
85 | 83 | $writer = $this->io()->writer(); |
86 | 84 | $writer->boldYellow('MIGRATION STATUS', true)->eol(); |
87 | 85 | $writer->bold('Migration path: '); |
@@ -72,7 +72,7 @@ |
||
72 | 72 | ) { |
73 | 73 | parent::__construct($app, $repository, $config, $filesystem); |
74 | 74 | $this->setName('migration:status') |
75 | - ->setDescription('Show current status of your migrations'); |
|
75 | + ->setDescription('Show current status of your migrations'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * class AbstractMigration |
54 | 54 | * @package Platine\Framework\Migration |
55 | 55 | */ |
56 | -abstract class AbstractMigration extends Schema |
|
57 | -{ |
|
56 | +abstract class AbstractMigration extends Schema { |
|
58 | 57 | /** |
59 | 58 | * Execute when do migrate |
60 | 59 | * @return void |
@@ -56,8 +56,7 @@ |
||
56 | 56 | * class MigrationEntity |
57 | 57 | * @package Platine\Framework\Migration |
58 | 58 | */ |
59 | -class MigrationEntity extends Entity |
|
60 | -{ |
|
59 | +class MigrationEntity extends Entity { |
|
61 | 60 | |
62 | 61 | /** |
63 | 62 | * {@inheritdoc} |
@@ -54,15 +54,13 @@ |
||
54 | 54 | * class MigrationRepository |
55 | 55 | * @package Platine\Framework\Migration |
56 | 56 | */ |
57 | -class MigrationRepository extends Repository |
|
58 | -{ |
|
57 | +class MigrationRepository extends Repository { |
|
59 | 58 | |
60 | 59 | /** |
61 | 60 | * Create new instance |
62 | 61 | * @param EntityManager $manager |
63 | 62 | */ |
64 | - public function __construct(EntityManager $manager) |
|
65 | - { |
|
63 | + public function __construct(EntityManager $manager) { |
|
66 | 64 | parent::__construct($manager, MigrationEntity::class); |
67 | 65 | } |
68 | 66 | } |