Skip to content

Commit

Permalink
add insert deployment trait filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
jturbide committed Jul 25, 2023
1 parent d60cf3f commit 7665f33
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Modules/Cli/Tasks/Traits/DeploymentTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,20 @@ public function fixEngineAction(): array
* Insert records
* @throws CliException
*/
public function insertAction(): array
public function insertAction(?string $models = null): array
{
$response = [
'saved' => 0,
'error' => [],
'message' => [],
];

$models = (!empty($models))? explode(',', $models) : null;

foreach ($this->insert as $modelName => $insert) {
if (is_array($models) && !in_array($modelName, $models, true)) {
continue;
}

foreach ($insert as $key => $row) {
$entity = new $modelName();
Expand Down

0 comments on commit 7665f33

Please sign in to comment.