mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-11-24 14:16:15 +01:00
parent
277a167621
commit
72d449b9bd
2 changed files with 13 additions and 11 deletions
|
@ -24,13 +24,13 @@ final class CreateTestDataCommand extends Command
|
|||
[
|
||||
'title' => 'Darjeeling',
|
||||
'description' => 'I love that tea!',
|
||||
'sys_language_uid' => 0
|
||||
'sys_language_uid' => 0,
|
||||
],
|
||||
[
|
||||
'title' => 'Earl Grey',
|
||||
'description' => 'A nice tea!',
|
||||
'sys_language_uid' => 0
|
||||
]
|
||||
'sys_language_uid' => 0,
|
||||
],
|
||||
];
|
||||
protected function configure(): void
|
||||
{
|
||||
|
@ -51,9 +51,9 @@ final class CreateTestDataCommand extends Command
|
|||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
/** @var integer $pageId */
|
||||
/** @var int $pageId */
|
||||
$pageId = $input->getArgument('pageId') ?? 0;
|
||||
/** @var boolean $deleteDataBefore */
|
||||
/** @var bool $deleteDataBefore */
|
||||
$deleteDataBefore = $input->getOption('delete-data-before') ?? false;
|
||||
$table = 'tx_tea_domain_model_tea';
|
||||
$connectionForTable = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($table);
|
||||
|
@ -67,7 +67,8 @@ final class CreateTestDataCommand extends Command
|
|||
$query = $connectionForTable;
|
||||
foreach ($this->teaData as $item) {
|
||||
$item = ['pid' => $pageId, ...$item];
|
||||
$query->insert($table,
|
||||
$query->insert(
|
||||
$table,
|
||||
$item
|
||||
);
|
||||
}
|
||||
|
|
|
@ -16,10 +16,11 @@ return static function (ContainerConfigurator $containerConfigurator) {
|
|||
->exclude('../Classes/Domain/Model/*');
|
||||
|
||||
$services->set(CreateTestDataCommand::class)
|
||||
->tag('console.command', [
|
||||
->tag(
|
||||
'console.command',
|
||||
[
|
||||
'command' => 'tea:createtestdata',
|
||||
'description'=>'Create test data in existing sysfolder'
|
||||
'description' => 'Create test data in existing sysfolder',
|
||||
]
|
||||
);
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue