literal example

list($prefix$column) = explode('.', $operation['column']);

            $type = $columnInfo[ucfirst($prefix) . ucfirst($column)]['type'];
            if ($operation['value'] && \in_array($type['decimal', 'integer', 'float'], true)) {
                $operation['value'] = str_replace(',', '.', $operation['value']);
            }

            // In set mode: If column is nullable and value is "" - set it to null             if ($operation['operator'] === 'set' && $columnInfo[ucfirst($prefix) . ucfirst($column)]['nullable'] && $operation['value'] == '') {
                $operationValue = 'NULL';
            } else {
                $operationValue = $builder->expr()->literal(
                    // Limiting the value length to prevent possible parsing errors                     substr($operation['value'], 0, self::MAX_VALUE_LENGTH)
                );
            }

            switch (strtolower($operation['operator'])) {
                case 'removestring':
                    $builder->set("{$prefix}.$column", new Literal(["REPLACE({$prefix}.{$column}, $operationValue, '')"]));
                    break;

                case 'divide':
                
private function addSorting(ProductNameSorting $sorting, QueryBuilder $query, ShopContextInterface $context): void
    {
        $query->leftJoin(
            self::PRODUCT,
            's_articles_translations',
            self::TRANSLATION,
            $query->expr()->andX(
                $query->expr()->eq(self::TRANSLATION . '.articleID', self::PRODUCT . '.id'),
                $query->expr()->eq(self::TRANSLATION . '.languageID', $context->getShop()->getId()),
                $query->expr()->isNotNull(self::TRANSLATION_NAME),
                $query->expr()->neq(self::TRANSLATION_NAME, $query->expr()->literal(''))
            )
        );

        $query->addOrderBy(
            self::exprIf(
                $query->expr()->isNull(self::TRANSLATION_NAME),
                self::PRODUCT . '.name',
                self::TRANSLATION_NAME
            ),
            $sorting->getDirection()
        );
    }

    public function clearRewriteCache()
    {
        $cache = (int) $this->config->offsetGet('routerCache');
        $cache = $cache < 360 ? 86400 : $cache;

        $builder = $this->db->createQueryBuilder();
        $builder
            ->from('s_core_config_values', 'v')
            ->join('v', 's_core_config_elements', 'e', 'v.element_id = e.id')
            ->select(['v.shop_id', 'v.value', 'e.id as element_id'])
            ->where($builder->expr()->like('e.name', $builder->expr()->literal('routerlastupdate')));

        $values = $builder->execute()->fetchAll(PDO::FETCH_ASSOC);
        $stmt = $this->db->prepare('UPDATE s_core_config_values SET value=? WHERE shop_id=? AND element_id=?');

        foreach ($values as $rawValue) {
            $value = unserialize($rawValue['value']['allowed_classes' => false]);
            $value = min(strtotime($value)time() - $cache);
            $value = date('Y-m-d H:i:s', $value);
            $value = serialize($value);
            $stmt->execute([$value$rawValue['shop_id']$rawValue['element_id']]);
        }
    }
Home | Imprint | This part of the site doesn't use cookies.