protected function sqlWhereConditions(string $extraWhereClause): array
    {
        // get the conditions
        $conditions = [];
        if ($extraWhereClause) {
            $conditions[] = "($extraWhereClause)";
        }
        $ids = $this->getIdFields();
        if (! count($ids)) {
            $this->logger->warning('Recordset: cannot get the ids to locate the current the record,'
                . ' will use all the fields to create the where clause'
                . "\n"
                . print_r([
                    'entity' => $this->entity,
                    'values' => $this->values,
                ], true));
            $ids = array_keys($this->datafields);
        }
        foreach ($this->datafields as $fieldname => $field) {
            if (! array_key_exists($fieldname, $this->values)) {
                continue;
            }
            if (! in_array($fieldname, $ids)) {
                continue;
            }
            if (null === $this->originalValues[$fieldname]) {
                $conditions[] = '(' . $this->dbal->sqlIsNull($this->dbal->sqlFieldEscape($fieldname)) . ')';
            } else {
                $conditions[] = '(' . $this->dbal->sqlFieldEscape($fieldname) . ' = '
                    . $this->dbal->sqlQuote($this->originalValues[$fieldname], $field['commontype'], false) . ')';
            }
        }
        return $conditions;
    }