/** * @return \Magento\Framework\DB\QueryInterface * @throws \Magento\Framework\Exception\LocalizedException */ public function create() { $mapper = $this->criteria->getMapperInterfaceName(); $mapperInstance = $this->mapperFactory->create($mapper); $select = $mapperInstance->map($this->criteria); $query = $this->queryFactory->create('Magento\\Framework\\DB\\Query', ['select' => $select, 'criteria' => $this->criteria, 'resource' => $this->resource]); return $query; }