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/Framework/Model/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/Ecombricks/Framework/Model/Config.php
<?php
/**
 * Copyright © eComBricks. All rights reserved.
 * See LICENSE.txt for license details.
 */
namespace Ecombricks\Framework\Model;

/**
 * Model config
 */
class Config implements \Ecombricks\Framework\Model\ConfigInterface
{
    
    /**
     * URL builder
     * 
     * @var \Magento\Framework\UrlInterface
     */
    protected $urlBuilder;
    
    /**
     * Model factory
     * 
     * @var \Ecombricks\Framework\Model\ModelFactoryInterface
     */
    protected $modelFactory;
    
    /**
     * Collection factory
     * 
     * @var \Ecombricks\Framework\Model\ResourceModel\Db\Collection\CollectionFactoryInterface
     */
    protected $collectionFactory;
    
    /**
     * Label
     * 
     * @var \Ecombricks\Framework\Model\LabelInterface
     */
    protected $label;
    
    /**
     * Key
     * 
     * @var string
     */
    protected $key;
    
    /**
     * Index field
     * 
     * @var string
     */
    protected $indexField;
    
    /**
     * Name field
     * 
     * @var string
     */
    protected $nameField;
    
    /**
     * Edit URL path
     * 
     * @var string
     */
    protected $editUrlPath;
    
    /**
     * Save URL path
     * 
     * @var string
     */
    protected $saveUrlPath;
    
    /**
     * Delete URL path
     * 
     * @var string
     */
    protected $deleteUrlPath;
    
    /**
     * Constructor
     * 
     * @param \Magento\Framework\UrlInterface $urlBuilder
     * @param \Ecombricks\Framework\Model\ModelFactoryInterface $modelFactory
     * @param \Ecombricks\Framework\Model\ResourceModel\Db\Collection\CollectionFactoryInterface $collectionFactory
     * @param \Ecombricks\Framework\Model\LabelInterface $label
     * @param string $key
     * @param string $indexField
     * @param string $nameField
     * @param string $editUrlPath
     * @param string $saveUrlPath
     * @param string $deleteUrlPath
     * @return void
     */
    public function __construct(
        \Magento\Framework\UrlInterface $urlBuilder,
        \Ecombricks\Framework\Model\ModelFactoryInterface $modelFactory,
        \Ecombricks\Framework\Model\ResourceModel\Db\Collection\CollectionFactoryInterface $collectionFactory,
        \Ecombricks\Framework\Model\LabelInterface $label,
        $key,
        $indexField,
        $nameField,
        $editUrlPath,
        $saveUrlPath,
        $deleteUrlPath
    )
    {
        $this->urlBuilder = $urlBuilder;
        $this->modelFactory = $modelFactory;
        $this->collectionFactory = $collectionFactory;
        $this->label = $label;
        $this->key = $key;
        $this->indexField = $indexField;
        $this->nameField = $nameField;
        $this->editUrlPath = $editUrlPath;
        $this->saveUrlPath = $saveUrlPath;
        $this->deleteUrlPath = $deleteUrlPath;
    }
    
    /**
     * Get model factory
     * 
     * @return \Ecombricks\Framework\Model\ModelFactoryInterface
     */
    public function getModelFactory()
    {
        return $this->modelFactory;
    }
    
    /**
     * Create model
     * 
     * @return \Magento\Framework\Model\AbstractModel
     */
    public function createModel()
    {
        return $this->modelFactory->create();
    }
    
    /**
     * Get collection factory
     * 
     * @return \Ecombricks\Framework\Model\ResourceModel\Db\Collection\CollectionFactoryInterface
     */
    public function getCollectionFactory()
    {
        return $this->collectionFactory;
    }
    
    /**
     * Create collection
     * 
     * @return \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
     */
    public function createCollection()
    {
        return $this->collectionFactory->create();
    }
    
    /**
     * Get label
     * 
     * @return \Ecombricks\Framework\Model\LabelInterface
     */
    public function getLabel()
    {
        return $this->label;
    }
    
    /**
     * Get key
     * 
     * @return string
     */
    public function getKey()
    {
        return $this->key;
    }
    
    /**
     * Get index field
     * 
     * @return string
     */
    public function getIndexField()
    {
        return $this->indexField;
    }
    
    /**
     * Get name field
     * 
     * @return string
     */
    public function getNameField()
    {
        return $this->nameField;
    }
    
    /**
     * Get URL
     * 
     * @param string|null $routePath
     * @param array|null $routeParams
     * @return string
     */
    protected function getUrl($routePath = null, $routeParams = null)
    {
        return $this->urlBuilder->getUrl($routePath, $routeParams);
    }
    
    /**
     * Get get edit URL path
     * 
     * @return string
     */
    public function getEditUrlPath()
    {
        return $this->editUrlPath;
    }
    
    /**
     * Get edit URL
     * 
     * @param mixed $modelId
     * @param array $routeParams
     * @return string
     */
    public function getEditUrl($modelId, $routeParams = [])
    {
        return $this->getUrl($this->editUrlPath, array_merge([$this->indexField => $modelId], $routeParams));
    }
    
    /**
     * Get save URL path
     * 
     * @return string
     */
    public function getSaveUrlPath()
    {
        return $this->saveUrlPath;
    }
    
    /**
     * Get save URL
     * 
     * @param mixed $modelId
     * @param array $routeParams
     * @return string
     */
    public function getSaveUrl($modelId, $routeParams = [])
    {
        return $this->getUrl($this->saveUrlPath, array_merge([$this->indexField => $modelId], $routeParams));
    }
    
    /**
     * Get delete URL path
     * 
     * @return string
     */
    public function getDeleteUrlPath()
    {
        return $this->deleteUrlPath;
    }
    
    /**
     * Get delete URL
     * 
     * @param mixed $modelId
     * @param array $routeParams
     * @return string
     */
    public function getDeleteUrl($modelId, $routeParams = [])
    {
        return $this->getUrl($this->deleteUrlPath, array_merge([$this->indexField => $modelId], $routeParams));
    }
    
}

Spamworldpro Mini