I have this method
public function getCarBrands() {
return $this->_objectManager->create('Scandimedia\Wheels\Model\CarModels')->getCollection()->getSelect()->group('brand');
}
But when I execute it and try to foreach the results with:
foreach($this->getCarBrands() as $model) {
echo $model->getData();
}
It does not do anything. But when I echo it returns:
SELECT `main_table`.* FROM `scandimedia_wheels_car_models` AS `main_table` GROUP BY `brand`
If I do get_class, it gives me this result: Magento\Framework\DB\Select
How can I actually load the results from the group and get the data without running the string as a query?
$this->getCarBrands()->getSize();
?