Collection.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Wishlist model collection
  8. *
  9. * @author Magento Core Team <core@magentocommerce.com>
  10. */
  11. namespace Magento\Wishlist\Model\ResourceModel\Wishlist;
  12. /**
  13. * @api
  14. * @since 100.0.2
  15. */
  16. class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
  17. {
  18. /**
  19. * Initialize resource
  20. *
  21. * @return void
  22. */
  23. protected function _construct()
  24. {
  25. $this->_init(\Magento\Wishlist\Model\Wishlist::class, \Magento\Wishlist\Model\ResourceModel\Wishlist::class);
  26. }
  27. /**
  28. * Filter collection by customer id
  29. *
  30. * @param int $customerId
  31. * @return $this
  32. */
  33. public function filterByCustomerId($customerId)
  34. {
  35. $this->addFieldToFilter('customer_id', $customerId);
  36. return $this;
  37. }
  38. /**
  39. * Filter collection by customer ids
  40. *
  41. * @param array $customerIds
  42. * @return $this
  43. */
  44. public function filterByCustomerIds(array $customerIds)
  45. {
  46. $this->addFieldToFilter('customer_id', ['in' => $customerIds]);
  47. return $this;
  48. }
  49. }