SynonymGroup.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Search\Model;
  7. use Magento\Framework\Model\AbstractModel;
  8. use Magento\Search\Api\Data\SynonymGroupInterface;
  9. class SynonymGroup extends AbstractModel implements SynonymGroupInterface
  10. {
  11. /**
  12. * Init resource model
  13. *
  14. * @return void
  15. */
  16. protected function _construct()
  17. {
  18. $this->_init(\Magento\Search\Model\ResourceModel\SynonymGroup::class);
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function getGroupId()
  24. {
  25. return $this->getData('group_id');
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function setGroupId($groupId)
  31. {
  32. $this->setData('group_id', $groupId);
  33. return $this;
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function getWebsiteId()
  39. {
  40. return $this->getData('website_id') === null ? 0 : $this->getData('website_id');
  41. }
  42. /**
  43. * {@inheritdoc}
  44. */
  45. public function setWebsiteId($websiteId)
  46. {
  47. $this->setData('website_id', $websiteId);
  48. return $this;
  49. }
  50. /**
  51. * {@inheritdoc}
  52. */
  53. public function getStoreId()
  54. {
  55. return $this->getData('store_id') === null ? 0 : $this->getData('store_id');
  56. }
  57. /**
  58. * {@inheritdoc}
  59. */
  60. public function setStoreId($storeId)
  61. {
  62. $this->setData('store_id', $storeId);
  63. return $this;
  64. }
  65. /**
  66. * {@inheritdoc}
  67. */
  68. public function getSynonymGroup()
  69. {
  70. return $this->getData('synonyms');
  71. }
  72. /**
  73. * {@inheritdoc}
  74. */
  75. public function setSynonymGroup($synonymGroup)
  76. {
  77. $this->setData('synonyms', $synonymGroup);
  78. return $this;
  79. }
  80. /**
  81. * sets the 'scope_id' to website:storeviewid
  82. *
  83. * @return void
  84. */
  85. public function setScope()
  86. {
  87. $this->setData('scope_id', $this->getWebsiteId() . ':' . $this->getStoreId());
  88. }
  89. }