Collection.php 926 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Email\Model\ResourceModel\Template;
  7. /**
  8. * Templates collection
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
  14. {
  15. /**
  16. * Template table name
  17. *
  18. * @var string
  19. */
  20. protected $_templateTable;
  21. /**
  22. * Define resource table
  23. *
  24. * @return void
  25. */
  26. public function _construct()
  27. {
  28. $this->_init(\Magento\Email\Model\Template::class, \Magento\Email\Model\ResourceModel\Template::class);
  29. $this->_templateTable = $this->getMainTable();
  30. }
  31. /**
  32. * Convert collection items to select options array
  33. *
  34. * @return array
  35. */
  36. public function toOptionArray()
  37. {
  38. return $this->_toOptionArray('template_id', 'template_code');
  39. }
  40. }