Integration.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Integration\Model\ResourceModel;
  7. /**
  8. * Integration resource model
  9. */
  10. class Integration extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
  11. {
  12. /**
  13. * Initialize resource model
  14. *
  15. * @return void
  16. */
  17. protected function _construct()
  18. {
  19. $this->_init('integration', 'integration_id');
  20. }
  21. /**
  22. * Select token for a given customer.
  23. *
  24. * @param int $consumerId
  25. * @return array|boolean - Row data (array) or false if there is no corresponding row
  26. */
  27. public function selectActiveIntegrationByConsumerId($consumerId)
  28. {
  29. $connection = $this->getConnection();
  30. $select = $connection->select()
  31. ->from($this->getMainTable())
  32. ->where('consumer_id = ?', $consumerId)
  33. ->where('status = ?', \Magento\Integration\Model\Integration::STATUS_ACTIVE);
  34. return $connection->fetchRow($select);
  35. }
  36. }