Video.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\ProductVideo\Model\ResourceModel;
  7. class Video extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
  8. {
  9. /**
  10. * Resource initialization
  11. *
  12. * @return void
  13. */
  14. public function _construct()
  15. {
  16. $this->_init('catalog_product_entity_media_gallery_value_video', 'value_id');
  17. }
  18. /**
  19. * @param array $data
  20. * @param array $fields
  21. * @return int
  22. * @throws \Magento\Framework\Exception\LocalizedException
  23. */
  24. public function insertOnDuplicate(array $data, array $fields = [])
  25. {
  26. return $this->getConnection()->insertOnDuplicate($this->getMainTable(), $data, $fields);
  27. }
  28. /**
  29. * @param array $ids
  30. * @return array
  31. * @throws \Magento\Framework\Exception\LocalizedException
  32. */
  33. public function loadByIds(array $ids)
  34. {
  35. $select = $this->getConnection()->select()->from(
  36. $this->getMainTable()
  37. )->where(
  38. 'value_id IN(?)',
  39. $ids
  40. );
  41. return $this->getConnection()->fetchAll($select);
  42. }
  43. }