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/app/code/Cnc/AdminHistory/Model/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/app/code/Cnc/AdminHistory/Model/Product.php
<?php
/**
 * Copyright (c) 2020 Kaliop Digital Commerce (https://digitalcommerce.kaliop.com) All Rights Reserved.
 * https://opensource.org/licenses/OSL-3.0  Open Software License (OSL 3.0)
 * Cnc
 * Radosław Stępień <[email protected]> <[email protected]>
 */
declare(strict_types=1);

namespace Cnc\AdminHistory\Model;

use Cnc\AdminHistory\Api\Data\ProductInterface;
use Cnc\AdminHistory\Api\Data\ProductInterfaceFactory;
use Cnc\AdminHistory\Model\ResourceModel\Product as ProductResource;
use Magento\Framework\Api\DataObjectHelper;
use Magento\Framework\Data\Collection\AbstractDb;
use Magento\Framework\Model\AbstractModel;
use Magento\Framework\Model\Context;
use Magento\Framework\Model\ResourceModel\AbstractResource;
use Magento\Framework\Registry;

/**
 * Class Product
 * Model for history product
 */
class Product extends AbstractModel implements ProductInterface
{
    protected $_eventPrefix = 'cnc_admin_history_product';

    /**
     * @var DataObjectHelper
     */
    protected $dataObjectHelper;

    /**
     * Product constructor.
     * @param Context $context
     * @param Registry $registry
     * @param DataObjectHelper $dataObjectHelper
     * @param AbstractResource|null $resource
     * @param AbstractDb|null $resourceCollection
     * @param array $data
     */
    public function __construct(
        Context $context,
        Registry $registry,
        DataObjectHelper $dataObjectHelper,
        AbstractResource $resource = null,
        AbstractDb $resourceCollection = null,
        array $data = []
    ) {
        parent::__construct($context, $registry, $resource, $resourceCollection, $data);
        $this->dataObjectHelper = $dataObjectHelper;
    }

    /**
     * Initialize resources
     *
     * @return void
     */
    protected function _construct()
    {
        $this->_init(ProductResource::class);
    }

    /**
     * @return $this
     */
    public function getDataModel(): Product
    {
        $productData = $this->getData();
        $this->dataObjectHelper->populateWithArray(
            $this,
            $productData,
            ProductInterface::class
        );

        return $this;
    }

    /**
     * @return int|null
     */
    public function getEntityId(): ?int
    {
        return $this->getData(self::ENTITY_ID);
    }

    /**
     * @param int $id
     * @return ProductInterface
     */
    public function setEntityId($id): ProductInterface
    {
        return $this->setData(self::ENTITY_ID, $id);
    }

    /**
     * @return int|null
     */
    public function getProductId(): ?int
    {
        return $this->getData(self::PRODUCT_ID);
    }

    /**
     * @param int $id
     * @return ProductInterface
     */
    public function setProductId($id): ProductInterface
    {
        return $this->setData(self::PRODUCT_ID, $id);
    }

    /**
     * @return string|null
     */
    public function getAttributeCode(): ?string
    {
        return $this->getData(self::ATTRIBUTE_CODE);
    }

    /**
     * @param string $attributeCode
     * @return ProductInterface
     */
    public function setAttributeCode(string $attributeCode): ProductInterface
    {
        return $this->setData(self::ATTRIBUTE_CODE, $attributeCode);
    }

    /**
     * @return string|null
     */
    public function getOldValue(): ?string
    {
        return $this->getData(self::OLD_VALUE);
    }

    /**
     * @param string $value
     * @return ProductInterface
     */
    public function setOldValue(string $value): ProductInterface
    {
        return $this->setData(self::OLD_VALUE, $value);
    }

    /**
     * @return string|null
     */
    public function getNewValue(): ?string
    {
        return $this->getData(self::NEW_VALUE);
    }

    /**
     * @param string $value
     * @return ProductInterface
     */
    public function setNewValue(string $value): ProductInterface
    {
        return $this->setData(self::NEW_VALUE, $value);
    }

    /**
     * @return string|null
     */
    public function getUpdatedAt(): ?string
    {
        return $this->getData(self::UPDATED_AT);
    }

    /**
     * @param string $timestamp
     * @return ProductInterface
     */
    public function setUpdatedAt(string $timestamp): ProductInterface
    {
        return $this->setData(self::UPDATED_AT, $timestamp);
    }

    /**
     * @return string|null
     */
    public function getUser(): ?string
    {
        return $this->getData(self::USER);
    }

    /**
     * @param string $user
     * @return ProductInterface
     */
    public function setUser(string $user): ProductInterface
    {
        return $this->setData(self::USER, $user);
    }
}

Spamworldpro Mini