I'm trying to getting the customer details in wishlist instead of showing the customer_id, I do in following way
/**
* @var \Magento\Wishlist\Model\WishlistFactory
*/
protected $_wishlistFactory;
public function __construct(
\Magento\Wishlist\Model\WishlistFactory $wishlistFactory){
$this->_wishlistFactory = $wishlistFactory;
}
public function getWishlistByCustomerId($customerId)
{
$wishlistCollections = $this->_wishlistFactory->create()->getCollection();
return $wishlistCollections->getData();
}
form this I got whole list wishlists with customer_id
[
{
"wishlist_id": "2",
"customer_id": "8",
"shared": "0",
"sharing_code": "138258069f07f9e03395ac6c71a02eff",
"updated_at": "2014-01-03 12:41:46"
},
{
"wishlist_id": "3",
"customer_id": "2",
"shared": "0",
"sharing_code": "0b29c50279346cba61010443e0410cb8",
"updated_at": "2013-12-06 10:48:04"
}
]
but my acceptation is how to show it in like
[
{
"wishlist_id": "2",
"customer_id": {
//TODO Customer Details
},
"shared": "0",
"sharing_code": "138258069f07f9e03395ac6c71a02eff",
"updated_at": "2014-01-03 12:41:46"
}
]
Is it possible to show this, I have try buy looping the wishlist and send the customer_id to \Magento\Customer\Api\CustomerRepositoryInterface $customerRepositoryInterface
but it take more time. Is there any shortest and coolest way to show the stuffs of foriegn keys.
Thanks in advance