mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-12-27 19:26:11 +01:00

[BUGFIX] Fix errors from php cs fixer

Related: #1120
This commit is contained in:
Karsten Nowak 2024-07-29 17:21:27 +02:00
parent 277a167621
commit 72d449b9bd
2 changed files with 13 additions and 11 deletions

View file

@ -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,23 +51,24 @@ 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);
if($deleteDataBefore) {
if ($deleteDataBefore) {
$query = $connectionForTable;
$query->delete($table, ['pid' => $pageId], [Connection::PARAM_INT]);
$output->writeln(sprintf('Existing data in page %s deleted.',$pageId));
$output->writeln(sprintf('Existing data in page %s deleted.', $pageId));
}
$query = $connectionForTable;
foreach ($this->teaData as $item) {
$item = ['pid' => $pageId, ...$item];
$query->insert($table,
$query->insert(
$table,
$item
);
}

View file

@ -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',
]
);
};