![]() 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/vendor/extmag/shiplab/Model/ |
<?php /** * Copyright © Extmag. All rights reserved. */ namespace Extmag\Shiplab\Model; use Extmag\Shiplab\Api\Data\ConfigurationInterface; use Magento\Framework\Model\AbstractModel; class Configuration extends AbstractModel implements ConfigurationInterface { /** * @return void */ protected function _construct() { parent::_construct(); $this->_init(ResourceModel\Configuration::class); } /** * @inheritDoc */ public function getId() { return parent::getData(self::ENTITY_ID); } /** * @inheritDoc */ public function setId($value) { return $this->setData(self::ENTITY_ID, $value); } /** * @inheritDoc */ public function getScope() { return parent::getData(self::SCOPE); } /** * @inheritDoc */ public function getScopeId() { return parent::getData(self::SCOPE_ID); } /** * @inheritDoc */ public function getPath() { return parent::getData(self::PATH); } /** * @inheritDoc */ public function getValue() { return parent::getData(self::VALUE); } /** * @inheritDoc */ public function setScope($scope) { return $this->setData(self::SCOPE, $scope); } /** * @inheritDoc */ public function setScopeId($scopeId) { return $this->setData(self::SCOPE_ID, $scopeId); } /** * @inheritDoc */ public function setPath($path) { return $this->setData(self::PATH, $path); } /** * @inheritDoc */ public function setValue($value) { return $this->setData(self::VALUE, $value); } public function getConfigByPath($path, $scope, $scopeId, $full = true) { $configDataCollection = $this->getCollection()->addScopeFilter($scope, $scopeId, $path); $config = []; foreach ($configDataCollection->getItems() as $data) { if ($full) { $config[$data->getPath()] = [ 'path' => $data->getPath(), 'value' => $data->getValue(), 'config_id' => $data->getConfigId(), ]; } else { $config[$data->getPath()] = $data->getValue(); } } return $config; } }