Model repositories and DB querying
Introduction
This article aims to teach developers how they can pull data from repositories by certain criteria.
For the sake of example, we will consider pulling product information and will work with \XLite\Model\Product models and their repository \XLite\Model\Repo\Product. You can work the same way with any other entities: categories, users, orders, etc.
Pulling product by ID
Repository method: find()
Code sample:
$product = \XLite\Core\Database::getRepo('XLite\Model\Product')->find($id);
//$product now contains product object