Skip to content

Commit

Permalink
FIX issue #25 - error on admin
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenix128 committed Nov 3, 2017
1 parent afbb6f4 commit 2bd0fe8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
26 changes: 15 additions & 11 deletions Observer/CoreCollectionAbstractLoadAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,23 @@ public function __construct(
public function execute(\Magento\Framework\Event\Observer $observer)
{
if ($this->config->isActive()) {
$obj = $observer->getEvent()->getCollection();
try {
$obj = $observer->getEvent()->getCollection();
$objName = preg_replace("/\\\\Interceptor$/", "", get_class($obj));

$objName = preg_replace("/\\\\Interceptor$/", "",
get_class($obj));
// @codingStandardsIgnoreStart
$objId = md5($objName . '::' . $obj->getSelect());
// @codingStandardsIgnoreEnd

$objId = md5($objName . '::' . $obj->getSelect());

$this->collectionRegistry->stop($objId, [
'collection' => $objName,
'items' => $obj->getSize(),
'page_num' => $obj->getCurPage(),
'sql' => '' . $obj->getSelect()
]);
$this->collectionRegistry->stop($objId, [
'collection' => $objName,
'items' => $obj->getSize(),
'page_num' => $obj->getCurPage(),
'sql' => '' . $obj->getSelect()
]);
} catch (\Exception $e) {
return;
}
}
}
}
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MSP_DevTools" setup_version="1.2.7">
<module name="MSP_DevTools" setup_version="1.2.8">
<sequence>
<module name="MSP_Common"/>

Expand Down

0 comments on commit 2bd0fe8

Please sign in to comment.