joinFromColumn); $joinToColumn = preg_replace('/\w+\./', '', $this->joinToColumn); $joinFromValues = array_map(function (array $row) use ($joinFromColumn) { return $row[$joinFromColumn]; }, $rows); $joinFromValues = array_filter($joinFromValues, function ($value) { return $value !== null; }); $this->query->andWhere($this->query->expr()->in($this->joinToColumn, $this->query->createNamedParameter($joinFromValues, IQueryBuilder::PARAM_STR_ARRAY, ':' . uniqid()))); $s = $this->query->getSQL(); $partitionedRows = $this->query->executeQuery()->fetchAll(); $columns = $this->query->getOutputColumns(); $nullResult = array_combine($columns, array_fill(0, count($columns), null)); $partitionedRowsByKey = []; foreach ($partitionedRows as $partitionedRow) { $partitionedRowsByKey[$partitionedRow[$joinToColumn]][] = $partitionedRow; } $result = []; foreach ($rows as $row) { if (isset($partitionedRowsByKey[$row[$joinFromColumn]])) { if ($this->joinMode !== self::JOIN_MODE_LEFT_NULL) { foreach ($partitionedRowsByKey[$row[$joinFromColumn]] as $partitionedRow) { $result[] = array_merge($row, $partitionedRow); } } } elseif ($this->joinMode === self::JOIN_MODE_LEFT || $this->joinMode === self::JOIN_MODE_LEFT_NULL) { $result[] = array_merge($nullResult, $row); } } return $result; } }