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/Ecombricks/InventoryConfig/Plugin/Model/ResourceModel/Config/Data/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/Ecombricks/InventoryConfig/Plugin/Model/ResourceModel/Config/Data/Collection.php
<?php
/**
 * Copyright © eComBricks. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Ecombricks\InventoryConfig\Plugin\Model\ResourceModel\Config\Data;

/**
 * Config data collection plugin
 */
class Collection extends \Ecombricks\Framework\Plugin\AbstractPlugin
{
    
    /**
     * Resource connection
     * 
     * @var \Magento\Framework\App\ResourceConnection
     */
    protected $resourceConnection;
    
    /**
     * Table mapper
     * 
     * @var \Ecombricks\Framework\App\ResourceConnection\TableMapperInterface
     */
    protected $tableMapper;
    
    /**
     * Constructor
     * 
     * @param \Magento\Framework\App\ResourceConnection $resourceConnection
     * @param \Ecombricks\Framework\App\ResourceConnection\TableMapperInterface $tableMapper
     * @return void
     */
    public function __construct(
        \Magento\Framework\App\ResourceConnection $resourceConnection,
        \Ecombricks\Framework\App\ResourceConnection\TableMapperInterface $tableMapper
    )
    {
        $this->resourceConnection = $resourceConnection;
        $this->tableMapper = $tableMapper;
    }
    
    /**
     * Get main table
     * 
     * @return string
     */
    protected function getMainTable()
    {
        $subject = $this->getSubject();
        $table = $subject->getResource()->getMainTable();
        if ($this->tableMapper->isEnabled() && !$subject->getConnection()->isTableExists($table)) {
            $this->tableMapper->setIsEnabled(false);
            $table = $this->resourceConnection->getTableName('core_config_data');
            $this->tableMapper->setIsEnabled(true);
        }
        return $table;
    }
    
    /**
     * Around get main table
     * 
     * @param \Magento\Config\Model\ResourceModel\Config\Data\Collection $subject
     * @param \Closure $proceed
     * @return string
     */
    public function aroundGetMainTable(
        \Magento\Config\Model\ResourceModel\Config\Data\Collection $subject,
        \Closure $proceed
    )
    {
        $this->setSubject($subject);
        return $this->getMainTable();
    }
    
}

Spamworldpro Mini