Exemplo n.º 1
0
 /**
  * Read data with translations from database
  *
  * @return array
  */
 protected function readData()
 {
     $sql = "\n            SELECT\n              LOWER(REPLACE(e.name, '_', '')) as name,\n              COALESCE(currentShop.value, parentShop.value, fallbackShop.value, e.value) as value,\n              LOWER(REPLACE(forms.name, '_', '')) as form,\n              currentShop.value as currentShopval,\n              parentShop.value as parentShopval,\n              fallbackShop.value as fallbackShopval\n\n            FROM s_core_config_elements e\n\n            LEFT JOIN s_core_config_values currentShop\n              ON currentShop.element_id = e.id\n              AND currentShop.shop_id = :currentShopId\n\n            LEFT JOIN s_core_config_values parentShop\n              ON parentShop.element_id = e.id\n              AND parentShop.shop_id = :parentShopId\n\n            LEFT JOIN s_core_config_values fallbackShop\n              ON fallbackShop.element_id = e.id\n              AND fallbackShop.shop_id = :fallbackShopId\n\n            LEFT JOIN s_core_config_forms forms\n              ON forms.id = e.form_id\n        ";
     $data = $this->_db->fetchAll($sql, array('fallbackShopId' => 1, 'parentShopId' => isset($this->_shop) && $this->_shop->getMain() !== null ? $this->_shop->getMain()->getId() : 1, 'currentShopId' => isset($this->_shop) ? $this->_shop->getId() : null));
     $result = array();
     foreach ($data as $row) {
         $value = !empty($row['value']) ? @unserialize($row['value']) : null;
         $result[$row['name']] = $value;
         // Take namespaces (form names) into account
         $result[$row['form'] . '::' . $row['name']] = $value;
     }
     $result['version'] = Shopware::VERSION;
     $result['revision'] = Shopware::REVISION;
     $result['versiontext'] = Shopware::VERSION_TEXT;
     return $result;
 }