Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Attributes
AgreementsProvider Class Reference
Inheritance diagram for AgreementsProvider:
AgreementsProviderInterface

Public Member Functions

 __construct (AgreementCollectionFactory $agreementCollectionFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig)
 
 getRequiredAgreementIds ()
 

Data Fields

const PATH_ENABLED = 'checkout/options/enable_agreements'
 

Protected Attributes

 $agreementCollectionFactory
 
 $scopeConfig
 
 $storeManager
 

Detailed Description

Provide Agreements stored in db

Definition at line 14 of file AgreementsProvider.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( AgreementCollectionFactory  $agreementCollectionFactory,
\Magento\Store\Model\StoreManagerInterface  $storeManager,
\Magento\Framework\App\Config\ScopeConfigInterface  $scopeConfig 
)
Parameters
AgreementCollectionFactory$agreementCollectionFactory
\Magento\Store\Model\StoreManagerInterface$storeManager
\Magento\Framework\App\Config\ScopeConfigInterface$scopeConfig@codeCoverageIgnore

Definition at line 42 of file AgreementsProvider.php.

Member Function Documentation

◆ getRequiredAgreementIds()

getRequiredAgreementIds ( )

Get list of required Agreement Ids

Returns
int[]

Implements AgreementsProviderInterface.

Definition at line 57 of file AgreementsProvider.php.

58  {
59  $agreementIds = [];
60  if ($this->scopeConfig->isSetFlag(self::PATH_ENABLED, ScopeInterface::SCOPE_STORE)) {
61  $agreementCollection = $this->agreementCollectionFactory->create();
62  $agreementCollection->addStoreFilter($this->storeManager->getStore()->getId());
63  $agreementCollection->addFieldToFilter('is_active', 1);
64  $agreementCollection->addFieldToFilter('mode', AgreementModeOptions::MODE_MANUAL);
65  $agreementIds = $agreementCollection->getAllIds();
66  }
67  return $agreementIds;
68  }

Field Documentation

◆ $agreementCollectionFactory

$agreementCollectionFactory
protected

Definition at line 24 of file AgreementsProvider.php.

◆ $scopeConfig

$scopeConfig
protected

Definition at line 29 of file AgreementsProvider.php.

◆ $storeManager

$storeManager
protected

Definition at line 34 of file AgreementsProvider.php.

◆ PATH_ENABLED

const PATH_ENABLED = 'checkout/options/enable_agreements'

Path to config node

Definition at line 19 of file AgreementsProvider.php.


The documentation for this class was generated from the following file: