Skip to content

Commit

Permalink
Added Migrations generate work with plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
jamielsharief committed Aug 1, 2020
1 parent 13517dc commit 51c5baf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Added

- Added Migrations generate work with plugins
- Added Record generator
- Added Form generator

Expand Down
7 changes: 5 additions & 2 deletions src/Console/Command/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,12 @@ protected function migration(array $data)
$data += ['code' => ''];

$version = date('YmdHis');

$folder = substr($this->getBaseFolder($data['name'], self::SRC), 0, -3) . 'database/migrations/';

$this->generate(
$this->getTemplateFilename('migration'),
DATABASE . DS . 'migrations' . DS . "{$version}{$data['class']}.php",
$folder . "{$version}{$data['class']}.php",
$data
);
}
Expand Down Expand Up @@ -758,7 +761,7 @@ protected function getTemplateFilename(string $name)
return $this->directory.DS.'generator'.DS.$name.'.tpl';
}

protected function getBaseFolder(string $class, $src = true)
protected function getBaseFolder(string $class, int $src = 1)
{
list($plugin, $name) = pluginsplit($class);
if ($plugin) {
Expand Down

0 comments on commit 51c5baf

Please sign in to comment.