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/Ecombricks/InventoryCommon/Model/ResourceModel/SourceItem/Option/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/app/code/Ecombricks/InventoryCommon/Model/ResourceModel/SourceItem/Option/Get.php
<?php
/**
 * Copyright © eComBricks. All rights reserved.
 * See LICENSE.txt for license details.
 */
declare(strict_types=1);

namespace Ecombricks\InventoryCommon\Model\ResourceModel\SourceItem\Option;

/**
 * Get source item options resource
 */
class Get
{
    /**
     * Connection provider
     * 
     * @var \Ecombricks\Common\Model\ResourceModel\ConnectionProvider
     */
    private $connectionProvider;

    /**
     * Table name
     * 
     * @var string
     */
    private $tableName;

    /**
     * Constructor
     * 
     * @param \Ecombricks\Common\Model\ResourceModel\ConnectionProvider $connectionProvider
     * @param string $tableName
     * @return void
     */
    public function __construct(
        \Ecombricks\Common\Model\ResourceModel\ConnectionProvider $connectionProvider,
        string $tableName
    )
    {
        $this->connectionProvider = $connectionProvider;
        $this->tableName = $tableName;
    }
    
    /**
     * Execute
     * 
     * @param array $skus
     * @param array|null $sourceCodes
     * @return array
     */
    public function execute(array $skus, array $sourceCodes = null): array
    {
        $select = $this->connectionProvider->getSelect()
            ->from($this->connectionProvider->getTable($this->tableName))
            ->where(\Ecombricks\InventoryCommon\Api\Data\SourceItemOptionInterface::SKU.' IN (?)', $skus)
            ->where(\Ecombricks\InventoryCommon\Api\Data\SourceItemOptionInterface::VALUE.' IS NOT NULL');
        if ($sourceCodes !== null) {
            $select->where(\Ecombricks\InventoryCommon\Api\Data\SourceItemOptionInterface::SOURCE_CODE.' IN (?)', $sourceCodes);
        }
        return $this->connectionProvider->getConnection()->fetchAll($select);
    }
}

Spamworldpro Mini