Skip to content

Commit ee9ecbe

Browse files
committed
Merge branch '3.next' into 3.x
2 parents 2acf80f + 47cae5a commit ee9ecbe

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

src/Command/BakeCommand.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use Cake\Core\ConventionsTrait;
2828
use Cake\Event\Event;
2929
use Cake\Event\EventManager;
30+
use Cake\ORM\Locator\TableLocator;
3031
use InvalidArgumentException;
3132
use function Cake\Core\pluginSplit;
3233

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

52+
/**
53+
* Initialize the command.
54+
*
55+
* @return void
56+
*/
57+
public function initialize(): void
58+
{
59+
parent::initialize();
60+
61+
$locator = $this->getTableLocator();
62+
if ($locator instanceof TableLocator) {
63+
$locator->allowFallbackClass(true);
64+
$this->setTableLocator($locator);
65+
}
66+
}
67+
5168
/**
5269
* Get the command name.
5370
*

src/Command/ModelCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -642,15 +642,15 @@ public function findBelongsToMany(Table $model, array $associations): array
642642
*
643643
* @param \Cake\ORM\Table $model The model to introspect.
644644
* @param \Cake\Console\Arguments $args CLI Arguments
645-
* @return array<string>|string|null
645+
* @return array<string>|string
646646
*/
647-
public function getDisplayField(Table $model, Arguments $args): array|string|null
647+
public function getDisplayField(Table $model, Arguments $args): array|string
648648
{
649649
if ($args->getOption('display-field')) {
650650
return (string)$args->getOption('display-field');
651651
}
652652

653-
return $model->getDisplayField();
653+
return $model->getDisplayField() ?? [];
654654
}
655655

656656
/**

src/Command/TemplateCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ class TemplateCommand extends BakeCommand
100100
*/
101101
public function initialize(): void
102102
{
103+
parent::initialize();
104+
103105
$this->path = current(App::path('templates'));
104106
}
105107

0 commit comments

Comments
 (0)