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/old/vendor/colissimo/module-shipping/Model/ResourceModel/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/colissimo/module-shipping/Model/ResourceModel/Price.php
<?php
/**
 * Colissimo Shipping Module
 *
 * @author    Magentix
 * @copyright Copyright © 2019 Magentix. All rights reserved.
 * @license   https://www.magentix.fr/en/licence.html Magentix Software Licence
 * @link      https://colissimo.magentix.fr/
 */
namespace Colissimo\Shipping\Model\ResourceModel;

use Colissimo\Shipping\Api\Data\PriceInterface;
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
use Magento\Framework\Model\AbstractModel;
use Magento\Framework\DataObject;

/**
 * Class Price
 */
class Price extends AbstractDb
{
    /**
     * Initialize resource model
     *
     * @return void
     * @phpcs:disable
     */
    protected function _construct()
    {
        $this->_init('colissimo_shipping_tablerate', 'pk');
    }

    /**
     * Truncate all prices
     *
     * @return bool
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function truncate()
    {
        $this->getConnection()->truncateTable($this->getMainTable());

        return true;
    }

    /**
     * Perform actions before object save
     *
     * @param AbstractModel|DataObject $object
     * @return $this
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     * @phpcs:disable
     */
    protected function _beforeSave(AbstractModel $object)
    {
        if (empty($object->getData(PriceInterface::WEIGHT_FROM))) {
            $object->setData(PriceInterface::WEIGHT_FROM, null);
        }
        if (empty($object->getData(PriceInterface::WEIGHT_TO))) {
            $object->setData(PriceInterface::WEIGHT_TO, null);
        }
        if (empty($object->getData(PriceInterface::PRICE))) {
            $object->setData(PriceInterface::PRICE, 0);
        }
        if (empty($object->getData(PriceInterface::STORE_ID))) {
            $object->setData(PriceInterface::STORE_ID, 0);
        }
        return $this;
    }
}

Spamworldpro Mini