Just minor line length fixes in ArrayIO class

This commit is contained in:
Clemens Schwaighofer
2022-06-22 18:10:23 +09:00
parent 6385a48824
commit 8ca5f0c824

View File

@@ -177,7 +177,7 @@ class ArrayIO extends \CoreLibs\DB\IO
public function dbResetArray($reset_pk = false): void public function dbResetArray($reset_pk = false): void
{ {
reset($this->table_array); reset($this->table_array);
foreach ($this->table_array as $column => $data_array) { foreach (array_keys($this->table_array) as $column) {
if (!$this->table_array[$column]['pk']) { if (!$this->table_array[$column]['pk']) {
unset($this->table_array[$column]['value']); unset($this->table_array[$column]['value']);
} elseif ($reset_pk) { } elseif ($reset_pk) {
@@ -208,7 +208,7 @@ class ArrayIO extends \CoreLibs\DB\IO
// delete files and build FK query // delete files and build FK query
reset($this->table_array); reset($this->table_array);
$q_where = ''; $q_where = '';
foreach ($this->table_array as $column => $data_array) { foreach (array_keys($this->table_array) as $column) {
// suchen nach bildern und lschen ... // suchen nach bildern und lschen ...
if ( if (
!empty($this->table_array[$column]['file']) && !empty($this->table_array[$column]['file']) &&
@@ -282,8 +282,11 @@ class ArrayIO extends \CoreLibs\DB\IO
} }
// check FK ... // check FK ...
if (isset($this->table_array[$column]['fk']) && isset($this->table_array[$column]['value'])) { if (
if ($q_where) { isset($this->table_array[$column]['fk']) &&
isset($this->table_array[$column]['value'])
) {
if (!empty($q_where)) {
$q_where .= ' AND '; $q_where .= ' AND ';
} }
$q_where .= $column .= ' = ' . $this->table_array[$column]['value']; $q_where .= $column .= ' = ' . $this->table_array[$column]['value'];
@@ -513,7 +516,10 @@ class ArrayIO extends \CoreLibs\DB\IO
// create select part & addition FK part // create select part & addition FK part
foreach ($this->table_array as $column => $data_array) { foreach ($this->table_array as $column => $data_array) {
// check FK ... // check FK ...
if (isset($this->table_array[$column]['fk']) && isset($this->table_array[$column]['value'])) { if (
isset($this->table_array[$column]['fk']) &&
isset($this->table_array[$column]['value'])
) {
if (!empty($q_where)) { if (!empty($q_where)) {
$q_where .= ' AND '; $q_where .= ' AND ';
} }
@@ -559,7 +565,6 @@ class ArrayIO extends \CoreLibs\DB\IO
} }
// set primary key // set primary key
if ($insert) { if ($insert) {
// FIXME: this has to be fixes by fixing DB::IO clas
$insert_id = $this->dbGetInsertPK(); $insert_id = $this->dbGetInsertPK();
if (is_array($insert_id)) { if (is_array($insert_id)) {
$insert_id = 0; $insert_id = 0;