Skip to content

Commit

Permalink
Merge pull request #229 from techdivision/extend-import
Browse files Browse the repository at this point in the history
  • Loading branch information
Mardl authored Mar 11, 2022
2 parents ef6ea9c + dbb261b commit 58b8ea2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Version 16.8.12

## Improvement

* None

## Bugfixes

* Extend prepareRow() method remove not foud entities

# Version 16.8.11

## Improvement
Expand Down
16 changes: 13 additions & 3 deletions src/Actions/Processors/AbstractBaseProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,26 @@ protected function getPreparedStatements()
* Prepare's and return's the passed row by removing the
* entity status.
*
* @param array $row The row to prepare
* @param array $row The row to prepare
* @param string $statement The statement string
*
* @return array The prepared row
*/
protected function prepareRow(array $row)
protected function prepareRow(array $row, $statement = '')
{

// remove the entity status
unset($row[EntityStatus::MEMBER_NAME]);

// Remove unused rows from statement
if (!empty($statement)) {
foreach ($row as $key => $value) {
if (!preg_match('/(:'.$key.'[^a-zA-Z_])|(:'.$key.'$)/', $statement)) {
unset($row[$key]);
}
}
}

// return the prepared row
return $row;
}
Expand Down Expand Up @@ -219,7 +229,7 @@ public function execute($row, $name = null, $primaryKeyMemberName = null)

try {
// finally execute the prepared statement
$statement->execute($this->prepareRow($row));
$statement->execute($this->prepareRow($row, $statement->queryString));
} catch (\PDOException $pdoe) {
// initialize the SQL statement with the placeholders
$sql = $statement->queryString;
Expand Down

0 comments on commit 58b8ea2

Please sign in to comment.