I am trying to extend inventory stock items by joining my own table with added information. When the product page is loaded it gets the stock item via StockItemRepository::getList($criteria). So I need to somehow join on my own table here.
My confusion is that with the new Magento 2 repositories rather than M1-style collections, there seems to be no option to join tables on.
To give a specific example, here is the contents of that getList method:
public function getList(\Magento\CatalogInventory\Api\StockItemCriteriaInterface $criteria)
{
$queryBuilder = $this->queryBuilderFactory->create();
$queryBuilder->setCriteria($criteria);
$queryBuilder->setResource($this->resource);
$query = $queryBuilder->create();
$collection = $this->stockItemCollectionFactory->create(['query' => $query]);
return $collection;
}
The queryBuilder is a simple class that just creates the select statement from the criteria, and the collection is de-coupled from the database query entirely. Although I can add fields and filters to the criteria much like a M1 collection, I cannot see where I would add a join here.
Am I barking up the wrong tree entirely, or have I missed where I would add a join?