![]() 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/magento/module-variable/Model/ResourceModel/Variable/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Variable\Model\ResourceModel\Variable; /** * Custom variable collection * * @author Magento Core Team <[email protected]> */ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection { /** * Store Id * * @var int */ protected $_storeId = 0; /** * Define resource model * * @return void */ protected function _construct() { parent::_construct(); $this->_init(\Magento\Variable\Model\Variable::class, \Magento\Variable\Model\ResourceModel\Variable::class); } /** * Setter * * @param integer $storeId * @return $this */ public function setStoreId($storeId) { $this->_storeId = $storeId; return $this; } /** * Getter * * @return integer */ public function getStoreId() { return $this->_storeId; } /** * Add store values to result * * @return $this */ public function addValuesToResult() { $this->getSelect()->join( ['value_table' => $this->getTable('variable_value')], 'value_table.variable_id = main_table.variable_id', ['value_table.plain_value', 'value_table.html_value'] ); $this->addFieldToFilter('value_table.store_id', ['eq' => $this->getStoreId()]); return $this; } /** * Retrieve option array * * @return array */ public function toOptionArray() { return $this->_toOptionArray('code', 'name'); } }