logger = $logger; $this->scopeConfig = $scopeConfig; $this->request = $request; } /** * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $collection * @return $this */ public function logCollectionQuery($collection) { if ($this->scopeConfig->isSetFlag(self::DEBUG_CONFIG_PATH) && $this->request->getParam(self::DEBUG_REQUEST_VAR, false) ) { $this->logger->amastyEcho($collection->getSelect()->__toString()); } return $this; } }