Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Integration.php
Go to the documentation of this file.
1 <?php
7 
32 {
36  const STATUS_INACTIVE = 0;
37 
38  const STATUS_ACTIVE = 1;
39 
40  const STATUS_RECREATED = 2;
41 
47  const TYPE_MANUAL = 0;
48 
49  const TYPE_CONFIG = 1;
50 
56  const ID = 'integration_id';
57 
58  const NAME = 'name';
59 
60  const EMAIL = 'email';
61 
62  const ENDPOINT = 'endpoint';
63 
64  const IDENTITY_LINK_URL = 'identity_link_url';
65 
66  const SETUP_TYPE = 'setup_type';
67 
68  const CONSUMER_ID = 'consumer_id';
69 
70  const STATUS = 'status';
71 
81  public function __construct(
82  \Magento\Framework\Model\Context $context,
83  \Magento\Framework\Registry $registry,
84  \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
85  \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
86  array $data = []
87  ) {
88  parent::__construct($context, $registry, $resource, $resourceCollection, $data);
89  }
90 
96  protected function _construct()
97  {
98  parent::_construct();
99  $this->_init(\Magento\Integration\Model\ResourceModel\Integration::class);
100  }
101 
108  public function loadByConsumerId($consumerId)
109  {
110  return $this->load($consumerId, self::CONSUMER_ID);
111  }
112 
119  public function loadActiveIntegrationByConsumerId($consumerId)
120  {
121  $integrationData = $this->getResource()->selectActiveIntegrationByConsumerId($consumerId);
122  $this->setData($integrationData ? $integrationData : []);
123  return $this;
124  }
125 
132  public function getStatus()
133  {
134  return (int)$this->getData(self::STATUS);
135  }
136 }
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
Definition: Integration.php:81
getData($key='', $index=null)
Definition: DataObject.php:119
$resource
Definition: bulk.php:12