ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,42 @@
<?php
namespace JR\NetSuite\Model\ResourceModel\Location;
use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;
use JR\NetSuite\Model\Location;
use JR\NetSuite\Model\ResourceModel\Location as LocationResource;
class Collection extends AbstractCollection
{
protected function _construct()
{
$this->_init(Location::class, LocationResource::class);
}
/**
* Insert or update based on UNIQUE combo 'key-processing'
* @param $key
* @param $value
*/
public function insertOrUpdate($item)
{
$connection = $this->getConnection();
try {
// Start a transaction
// $connection->beginTransaction();
// Insert new item or update existing one
$connection->insertOnDuplicate($this->getMainTable(), $item, ['data', 'status']);
// Commit the transaction
// $connection->commit();
} catch (\Exception $e) {
// Rollback the transaction in case of an error
$connection->rollBack();
throw new \Magento\Framework\Exception\LocalizedException(
__('Error in insertOrUpdate: %1', $e->getMessage()),
$e
);
}
}
}