Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #73 from Tjitse-E/bugfix/delete-action-messages
Browse files Browse the repository at this point in the history
Fix array to string conversion
  • Loading branch information
peterjaap authored Apr 29, 2021
2 parents 84b39a5 + bac501c commit 4eec814
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/Elgentos/Masquerade/Console/RunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ private function fakeData(array $table) : void

/** @var DataProcessorFactory $dataProcessorFactory */
$dataProcessorFactory = new $dataProcessorFactoryClass();
$tableName = $table['name'];
try {
$dataProcessor = $dataProcessorFactory->create($this->output, $this->tableServiceFactory, $table);
} catch (TableDoesNotExistsException $exception) {
$this->output->info('Table %s does not exists. Skipping...', $table['name']);
$this->output->info('Table %s does not exists. Skipping...', $tableName);
return;
}

Expand All @@ -189,14 +190,14 @@ private function fakeData(array $table) : void
$isTruncate = $table['provider']['truncate'] ?? false;

if ($isIntegrityImportant && $isDelete) {
$this->output->info('Deleting records from %s table', $table);
$this->output->info('Deleting records from %s table', $tableName);
$dataProcessor->delete();
$this->output->success('Records have been deleted from %s table', $table);
$this->output->success('Records have been deleted from %s table', $tableName);
return;
} elseif ($isDelete || $isTruncate) {
$this->output->info('Truncating records from %s table', $table);
$this->output->info('Truncating records from %s table', $tableName);
$dataProcessor->truncate();
$this->output->success('Records have been truncated from %s table', $table);
$this->output->success('Records have been truncated from %s table', $tableName);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public function create(

$whereCondition = $tableConfiguration['where'] ?? '';

foreach ($tableConfiguration['columns'] as $column => $columnData) {
$columns = $tableConfiguration['columns'] ?? [];
foreach ($columns as $column => $columnData) {
if ($columnData['nullColumnBeforeRun'] ?? false) {
if (strpos($whereCondition, $column) !== false) {
$output->warning(
Expand Down

0 comments on commit 4eec814

Please sign in to comment.