Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/Command/BakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Cake\Core\ConventionsTrait;
use Cake\Event\Event;
use Cake\Event\EventManager;
use Cake\ORM\Locator\TableLocator;
use InvalidArgumentException;
use function Cake\Core\pluginSplit;

Expand All @@ -48,6 +49,22 @@ abstract class BakeCommand extends Command
*/
protected string $pathFragment;

/**
* Initialize the command.
*
* @return void
*/
public function initialize(): void
{
parent::initialize();

$locator = $this->getTableLocator();
if ($locator instanceof TableLocator) {
$locator->allowFallbackClass(true);
$this->setTableLocator($locator);
}
}

/**
* Get the command name.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Command/TemplateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class TemplateCommand extends BakeCommand
*/
public function initialize(): void
{
parent::initialize();

$this->path = current(App::path('templates'));
}

Expand Down
Loading