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/Xtento/StockImport/Model/Import/Entity/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/app/code/Xtento/StockImport/Model/Import/Entity/AbstractEntity.php
<?php

/**
 * Product:       Xtento_StockImport
 * ID:            u66QkJ5rBwmimhUzUElhIKqqWRvsbhC3WLqSMk5AjmQ=
 * Last Modified: 2019-02-05T17:10:52+00:00
 * File:          app/code/Xtento/StockImport/Model/Import/Entity/AbstractEntity.php
 * Copyright:     Copyright (c) XTENTO GmbH & Co. KG <[email protected]> / All rights reserved.
 */

namespace Xtento\StockImport\Model\Import\Entity;

use Magento\Framework\App\ResourceConnection;
use Magento\Framework\DataObject;
use Magento\Framework\Registry;

abstract class AbstractEntity extends DataObject
{
    /**
     * @var ResourceConnection
     */
    protected $resourceConnection;

    /**
     * @var Registry
     */
    protected $registry;

    /**
     * Resource models, read/write adapater
     */
    /** @var $readAdapter \Magento\Framework\Db\Adapter\Pdo\Mysql */
    protected $readAdapter;

    /** @var $writeAdapter \Magento\Framework\Db\Adapter\Pdo\Mysql */
    protected $writeAdapter;

    /**
     * Database table name cache
     */
    protected $tableNames = [];

    /**
     * AbstractEntity constructor.
     *
     * @param array $data
     * @param ResourceConnection $resourceConnection
     * @param Registry $frameworkRegistry
     */
    public function __construct(
        ResourceConnection $resourceConnection,
        Registry $frameworkRegistry,
        array $data = []
    ) {
        $this->resourceConnection = $resourceConnection;
        $this->registry = $frameworkRegistry;

        $this->readAdapter = $this->resourceConnection->getConnection('core_read');
        $this->writeAdapter = $this->resourceConnection->getConnection('core_write');

        parent::__construct($data);
    }

    /**
     * Get database table name for entity
     *
     * @param $entity
     *
     * @return bool
     */
    protected function getTableName($entity)
    {
        if (!isset($this->tableNames[$entity])) {
            try {
                $this->tableNames[$entity] = $this->resourceConnection->getTableName($entity);
            } catch (\Exception $e) {
                return false;
            }
        }
        return $this->tableNames[$entity];
    }

    /**
     * Return configuration value
     *
     * @param $key
     *
     * @return mixed
     */
    public function getConfig($key)
    {
        $configuration = $this->getProfile()->getConfiguration();
        if (isset($configuration[$key])) {
            return $configuration[$key];
        } else {
            return false;
        }
    }

    public function getConfigFlag($key)
    {
        return (bool)$this->getConfig($key);
    }

    public function getLogEntry()
    {
        return $this->registry->registry('stockimport_log');
    }
}

Spamworldpro Mini