Im creating a custom product Api with searchCriteria from \Magento\Catalog\Model\ResourceModel\Product\Collection
And I joined other table to this collection;
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
{
/** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $collection */
$collection = $this->collectionFactory->create();
$collection->getSelect()->joinLeft(array("vendorProduct"=>'ced_csmarketplace_vendor_products'), 'e.entity_id = vendorProduct.product_id',array('vendor_id' => "vendor_id"));
$this->extensionAttributesJoinProcessor->process($collection);
$collection->addAttributeToSelect('*');
$collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
$collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
$this->collectionProcessor->process($searchCriteria, $collection);
$collection->load();
$collection->addCategoryIds();
$this->addExtensionAttributes($collection);
$searchResult = $this->searchResultsFactory->create();
$searchResult->setSearchCriteria($searchCriteria);
$searchResult->setItems($collection->getItems());
$searchResult->setTotalCount($collection->getSize());
return $searchResult;
}
The joined data not show when I call this Api.
But if I "return $collection->getData();" it will show the joined data.