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/InventoryInventoryCatalog/Setup/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/Ecombricks/InventoryInventoryCatalog/Setup/AbstractSourceItemOptionInstallSchema.php
<?php
/**
 * Copyright © eComBricks. All rights reserved.
 * See LICENSE.txt for license details.
 */
declare(strict_types=1);

namespace Ecombricks\InventoryInventoryCatalog\Setup;

/**
 * Abstract source item option install schema
 */
abstract class AbstractSourceItemOptionInstallSchema extends \Ecombricks\Inventory\Setup\AbstractInstallSchema
{
    
    /**
     * Surce item option label
     * 
     * @var \Ecombricks\InventoryInventoryCatalog\Model\SourceItemOption\Label
     */
    protected $sourceItemOptionLabel;
    
    /**
     * Table name
     * 
     * @var string
     */
    protected $tableName;
    
    /**
     * Constructor
     * 
     * @param \Ecombricks\InventoryInventoryCatalog\Model\SourceItemOption\Label $sourceItemOptionLabel
     * @param string $tableName
     * @return void
     */
    public function __construct(
        \Ecombricks\InventoryInventoryCatalog\Model\SourceItemOption\Label $sourceItemOptionLabel,
        string $tableName
    )
    {
        $this->sourceItemOptionLabel = $sourceItemOptionLabel;
        $this->tableName = $tableName;
    }
    
    /**
     * Get value column
     * 
     * @return array
     */
    abstract protected function getValueColumn(): array;
    
    /**
     * Create source item option table
     * 
     * @return $this
     */
    protected function createSourceItemOptionTable()
    {
        $table = $this->getConnection()
            ->newTable($this->getTable($this->tableName))
            ->setComment('Inventory '.$this->sourceItemOptionLabel->renderWordsUppercased());
        $this
            ->addTableColumn($table, $this->getSourceColumn([
                'primary' => true,
                'nullable' => false,
            ]))
            ->addTableColumn($table, [
                'name' => 'sku',
                'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                'length' => 64,
                'options' => [
                    'primary' => true,
                    'nullable' => false,
                ],
                'comment' => 'SKU',
            ])
            ->addTableColumn($table, array_merge_recursive(
                $this->getValueColumn(),
                [
                    'name' => 'value',
                    'options' => [
                        'nullable' => true,
                    ],
                    'comment' => 'Value',
                ]
            ))
            ->createTable($table);
        return $this;
    }
    
    /**
     * Execute
     * 
     * @return $this
     */
    protected function execute()
    {
        $this->createSourceItemOptionTable();
        return $this;
    }
    
}

Spamworldpro Mini