Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/cartforge.co/app/code/Webkul/PrivateShop/Model/ResourceModel/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/app/code/Webkul/PrivateShop/Model/ResourceModel/PrivateProduct.php
<?php
/**
 * Webkul Software
 *
 * @category  Webkul
 * @package   Webkul_PrivateShop
 * @author    Webkul Software Private Limited
 * @copyright Webkul Software Private Limited (https://webkul.com)
 * @license   https://store.webkul.com/license.html
 */
namespace Webkul\PrivateShop\Model\ResourceModel;

class PrivateProduct extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
    /**
     * Define resource model
     *
     * @return void
     */
    protected function _construct()
    {
        $this->_init('webkul_private_product', 'entity_id');
    }

    /**
     * Save multiple records
     *
     * @param array $data
     * @return void
     * @throws \Exception
     */
    public function saveMultiple($data)
    {
        if (!empty($data)) {
            $connection = $this->getConnection();
            $insertData = [];
            foreach ($data as $insertArray) {
                $insertData[] = $insertArray;
            }
            
            try {
                $connection->beginTransaction();
                $connection->insertMultiple($this->getMainTable(), $insertData);
                $connection->commit();
            } catch (\Exception $e) {
                $connection->rollBack();
                throw new \Magento\Framework\Exception\LocalizedException($e->getMessage());
            }
        }
    }

    /**
     * Update multiple records
     *
     * @param array $updateData
     * @return void
     * @throws \Exception
     */
    public function updateMultiple($updateData)
    {
        $connection = $this->getConnection();
        
        $conditions = [];
        foreach ($updateData as $value) {
            $where = $connection->quoteInto('entity_id=?', $value['entity_id']);
            try {
                $connection->beginTransaction();
                $connection->update($this->getMainTable(), $value, $where);
                $connection->commit();
            } catch (\Exception $e) {
                $connection->rollBack();
                \Magento\Framework\Exception\LocalizedException($e->getMessage());
            }
        }
    }
}

Spamworldpro Mini