Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: FamousWolf/randomdata
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.0
Choose a base ref
...
head repository: FamousWolf/randomdata
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 6 commits
  • 4 files changed
  • 2 contributors

Commits on Apr 25, 2022

  1. [TASK] Add formatted command line output

    Rudy Gnodde committed Apr 25, 2022
    Copy the full SHA
    44524bd View commit details
  2. [CLEANUP] Fix typo in function name

    Rudy Gnodde committed Apr 25, 2022
    Copy the full SHA
    c7acb5d View commit details
  3. Merge pull request #13 from FamousWolf/10-format-command-line-output

    [TASK] Add formatted command line output
    FamousWolf authored Apr 25, 2022
    Copy the full SHA
    36886e6 View commit details

Commits on Apr 26, 2022

  1. [TASK] Update README.md

    FamousWolf authored Apr 26, 2022
    Copy the full SHA
    afd2f98 View commit details

Commits on Apr 7, 2023

  1. Copy the full SHA
    ec6dc8b View commit details

Commits on Mar 1, 2024

  1. Update README.md

    FamousWolf authored Mar 1, 2024
    Copy the full SHA
    8237997 View commit details
Showing with 44 additions and 22 deletions.
  1. +3 −0 ChangeLog
  2. +37 −18 Classes/Service/RandomdataService.php
  3. +3 −3 README.md
  4. +1 −1 composer.json
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2023-04-07 Rudy Gnodde <rudy@famouswolf.com>
* Replace deprecated Faker library with maintained fork

2021-02-23 Rudy Gnodde <info@windinternet.nl>
* Version 1.1.0
* TYPO3 11 compatibility
55 changes: 37 additions & 18 deletions Classes/Service/RandomdataService.php
Original file line number Diff line number Diff line change
@@ -116,8 +116,14 @@ public function generate($configurationFile, $locale, $output = null)

$this->faker = Factory::create($locale);

$this->output('Loading configuration file "' . $configurationFile . '"');
$this->loadConfigurationFile($configurationFile);
$this->outputWithoutNewLine('Loading configuration file "' . $configurationFile . '" ...');
try {
$this->loadConfigurationFile($configurationFile);
} catch(\Throwable $e) {
$this->output(' <fg=red>FAIL</>');
throw $e;
}
$this->output(' <fg=green>OK</>');

foreach ($this->configuration as $configurationKey => $itemConfiguration) {
$this->generateItem($configurationKey, $itemConfiguration);
@@ -194,23 +200,29 @@ protected function loadConfigurationFile($configurationFile)
*/
protected function generateItem($configurationKey, array $itemConfiguration)
{
$this->output('Generating data for item "' . $configurationKey . '"');
$table = $this->getItemTable($configurationKey, $itemConfiguration);
$pid = $this->getItemPid($configurationKey, $itemConfiguration);
$action = $this->getItemAction($configurationKey, $itemConfiguration);
$fields = $this->getItemFields($configurationKey, $itemConfiguration);

switch ($action) {
case 'insert':
$this->generateAndInsertRecords($configurationKey, $table, $pid, $fields, $itemConfiguration);
break;
case 'replace':
$this->generateAndReplaceRecords($configurationKey, $table, $pid, $fields, $itemConfiguration);
break;
default:
$this->dispatchSignalSlot('generateItemCustomAction', [$configurationKey, $table, $pid, $action, $fields, $itemConfiguration, $this]);
break;
$this->outputWithoutNewLine('Generating data for item "' . $configurationKey . '" ...');
try {
$table = $this->getItemTable($configurationKey, $itemConfiguration);
$pid = $this->getItemPid($configurationKey, $itemConfiguration);
$action = $this->getItemAction($configurationKey, $itemConfiguration);
$fields = $this->getItemFields($configurationKey, $itemConfiguration);

switch ($action) {
case 'insert':
$this->generateAndInsertRecords($configurationKey, $table, $pid, $fields, $itemConfiguration);
break;
case 'replace':
$this->generateAndReplaceRecords($configurationKey, $table, $pid, $fields, $itemConfiguration);
break;
default:
$this->dispatchSignalSlot('generateItemCustomAction', [$configurationKey, $table, $pid, $action, $fields, $itemConfiguration, $this]);
break;
}
} catch(\Throwable $e) {
$this->output(' <fg=red>FAIL</>');
throw $e;
}
$this->output(' <fg=green>OK</>');
}

/**
@@ -494,4 +506,11 @@ protected function output($message)
$this->output->writeln($message);
}
}

protected function outputWithoutNewLine($message)
{
if (!empty($this->output)) {
$this->output->write($message);
}
}
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# TYPO3 Extension `randomdata`
TYPO3 extensions to generate new random data or replace existing data with random data

This extensions uses https://github.com/fzaninotto/Faker and was loosely based on https://github.com/georgringer/faker. Thanks go out to the builders, contributors and maintainers of those projects.
This extensions uses https://github.com/FakerPHP/Faker and was inspired by https://github.com/georgringer/faker. Thanks go out to the builders, contributors and maintainers of those projects.

## Requirements
- TYPO3 CMS 8.7, 9.5 or 10.4
- PHP 7+
- TYPO3 CMS 9.5, 10.4 or 11.5
- PHP 7.2+
- Licence: GPL 3.0

## Manual
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
"license": "GPL-3.0-or-later",
"require": {
"typo3/cms-core": "^9.5.30 || ^10.4.20 || ^11.3.3",
"fzaninotto/faker": "^1.8"
"fakerphp/faker": "^1.19"
},
"replace": {
"typo3-ter/randomdata": "self.version"