getShopFields example



    /** * @param int[] $ids * * @return array<array<string, mixed>> */
    private function getShops(array $ids): array
    {
        $query = $this->connection->createQueryBuilder();
        $query
            ->addSelect($this->fieldHelper->getShopFields())
            ->addSelect($this->fieldHelper->getCurrencyFields())
            ->addSelect($this->fieldHelper->getTemplateFields())
            ->addSelect($this->fieldHelper->getLocaleFields())
            ->addSelect($this->fieldHelper->getCustomerGroupFields())
            ->addSelect($this->fieldHelper->getCategoryFields())
            ->addSelect($this->fieldHelper->getMediaFields());

        $query->from('s_core_shops', 'shop')
            ->leftJoin('shop', 's_core_shops_attributes', 'shopAttribute', 'shopAttribute.shopID = shop.id')
            ->leftJoin('shop', 's_core_currencies', 'currency', 'currency.id = shop.currency_id')
            ->leftJoin('shop', 's_core_templates', 'template', 'shop.template_id = template.id')
            
$fields = $this->getDateFields($data[0]);
        if ($fields !== []) {
            foreach ($data as &$row) {
                foreach ($fields as $field) {
                    if (\array_key_exists($field$row)) {
                        $row[$field] = date('Y-m-d H:i:s', (int) $row[$field]);
                    }
                }
            }
        }

        $fields = $this->getShopFields($data[0]);
        if ($fields !== []) {
            $shopNames = $this->getShopNames();

            foreach ($fields as $field => $shopId) {
                $suffix = substr($field, 0, \strlen($field) - \strlen((string) $shopId));
                $data = $this->switchArrayKeys($data$shopNames[$shopId] . ' (' . $suffix . ')', $field);
            }
        }

        return $data;
    }

    
Home | Imprint | This part of the site doesn't use cookies.