Skip to content

Commit f794888

Browse files
Merge branch 'release/2.27.2'
2 parents 7dfbdb2 + bdf249b commit f794888

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
## [2.27.2] - 2024-11-08
11+
### Fixed
12+
- Issue when saving nodes w/ db prefix ([#345](https://github.com/SnowdogApps/magento2-menu/pull/345))
13+
1014
## [2.27.1] - 2024-08-07
1115
### Fixed
1216
- Swagger docs (#332)

Model/ResourceModel/Menu/Node.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,21 @@
88
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
99
use Magento\Framework\Model\ResourceModel\Db\Context;
1010
use Magento\Framework\Serialize\SerializerInterface;
11+
use Magento\Framework\App\ResourceConnection;
1112

1213
class Node extends AbstractDb
1314
{
1415
protected $serializer;
16+
protected $resource;
1517

1618
public function __construct(
1719
Context $context,
1820
SerializerInterface $serializer,
21+
ResourceConnection $resource,
1922
$connectionName = null
2023
) {
2124
$this->serializer = $serializer;
25+
$this->resource = $resource;
2226
parent::__construct($context, $connectionName);
2327
}
2428

@@ -29,8 +33,9 @@ protected function _construct()
2933

3034
protected function _afterSave(AbstractModel $object)
3135
{
32-
$connection = $this->getConnection();
33-
$connection->delete('snowmenu_customer', ['node_id = ?' => $object->getNodeId()]);
36+
$connection = $this->resource->getConnection();
37+
$tableName = $this->resource->getTableName('snowmenu_customer');
38+
$connection->delete($tableName, ['node_id = ?' => $object->getNodeId()]);
3439

3540
$nodeCustomerGroups = $object->getData('customer_groups');
3641
if ($nodeCustomerGroups && is_string($nodeCustomerGroups)) {
@@ -44,7 +49,7 @@ protected function _afterSave(AbstractModel $object)
4449
];
4550
}
4651
if ($nodeCustomerGroups) {
47-
$connection->insertMultiple('snowmenu_customer', $insertData);
52+
$connection->insertMultiple($tableName, $insertData);
4853
}
4954

5055
return parent::_afterSave($object);

0 commit comments

Comments
 (0)