objResponse; $this->getData($arrData); $objResponse->addLogEntry('Start datalake for ' . $this->getClassName(), 'global', $this->getClassName(), 0); $intStartTime = $objResponse->microtimeFloat(); $objResponse->addLogEntry('End datalake for ' . $this->getClassName(), 'global', $this->getClassName(), $objResponse->getDuration($intStartTime)); return $objResponse->getEntityMap(); } protected function getData($arrData) { $objResponse = $this->objResponse; $connection = $this->objResourceConnection->getConnection(); $arrTables = $connection->fetchCol('show tables'); if (in_array($this->objResourceConnection->getTableName('sales_order'), $arrTables) && in_array($this->objResourceConnection->getTableName('sales_order_item'), $arrTables)) { $start_date = $arrData['params']['from']; $filter = ($start_date ? " AND so.updated_at > '" . $start_date . "' " : ''); $rowsFound = true; $offset = 0; while ($rowsFound) { $rowsFound = false; $objQuery = " SELECT " . " so.increment_id AS order_id, " . " so.status, " . " so.store_id, " . " so.customer_id, " . " so.created_at, " . " so.updated_at, " . " so.order_currency_code, " . " so.grand_total, " . " so.shipping_amount, " . " so.tax_amount, " . " soi.item_id, " . " soi.sku, " . " soi.name, " . " soi.qty_ordered, " . " soi.price, " . " soi.tax_percent, " . " soi.updated_at as item_updated_at, " . " st.name as website_name " . " FROM sales_order so " . " JOIN sales_order_item soi ON so.entity_id = soi.order_id " . " JOIN store AS st ON so.store_id=st.store_id " . " WHERE 1=1 " . $filter . " ORDER BY so.updated_at ASC " . " LIMIT " . self::LIMIT . " OFFSET " . $offset; $arrRows = $connection->fetchAll($objQuery); foreach($arrRows as $num => $row) { $rowsFound = true; $objResponse->addEntities([$this->getClassName() => ['entry'.$num => $row ]], 'datalake', ['entry'.$num]); } $offset += self::LIMIT; } } else { $objResponse->addEntities([$this->getClassName() => ['Error' => 'table not found']], 'datalake', ['Error']); } } }