![]() 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-sales-sequence/Model/ResourceModel/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\SalesSequence\Model\ResourceModel; use Magento\Framework\Model\ResourceModel\Db\Context as DatabaseContext; use Magento\SalesSequence\Model\ProfileFactory; /** * Class Profile represents profile data for sequence as prefix, suffix, start value etc. * * @api * @since 100.0.2 */ class Profile extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { /** * Event prefix * * @var string */ protected $_eventPrefix = 'sales_sequence_profile'; /** * Model initialization * * @return void */ protected function _construct() { $this->_init('sales_sequence_profile', 'profile_id'); } /** * @var ProfileFactory */ protected $profileFactory; /** * @param DatabaseContext $context * @param ProfileFactory $profileFactory * @param string $connectionName */ public function __construct( DatabaseContext $context, ProfileFactory $profileFactory, $connectionName = null ) { $this->profileFactory = $profileFactory; parent::__construct($context, $connectionName); } /** * Load active profile * * @param int $metadataId * @return \Magento\SalesSequence\Model\Profile * @throws \Magento\Framework\Exception\LocalizedException */ public function loadActiveProfile($metadataId) { $profile = $this->profileFactory->create(); $connection = $this->getConnection(); $bind = ['meta_id' => $metadataId]; $select = $connection->select() ->from($this->getMainTable(), ['profile_id']) ->where('meta_id = :meta_id') ->where('is_active = 1'); $profileId = $connection->fetchOne($select, $bind); if ($profileId) { $this->load($profile, $profileId); } return $profile; } }