/** * {@inheritDoc} */ protected function createReadModel() { $readModel = new PeopleThatBoughtThisProductAlsoBought('purchased_product_id'); $readModel->addProduct('also_bought_product_id', 5); $readModel->addProduct('another_bought_product_id', 2); return $readModel; }
private function createReadModel($productId, array $products) { $readModel = new PeopleThatBoughtThisProductAlsoBought($productId); foreach ($products as $productId => $count) { $readModel->addProduct($productId, $count); } return $readModel; }
private function addProducts(PeopleThatBoughtThisProductAlsoBought $readModel, array $products) { foreach ($products as $productId => $count) { $readModel->addProduct($productId, $count); } }