public function import($filePath) { $rows = $this->getFileContentWithoutHeader($filePath); foreach ($rows as $row) { $address = $row[5]; $name = $row[6]; $merchant = $this->getMerchant($name, $address); $product = new Product($row[0], $row[1], $row[2], new \DateTime($row[3]), new \DateTime($row[4]), Product::STATUS_AVAILABLE, $merchant); $this->productRepository->save($product); } }
public function byMerchant() { return $this->productRepository->countByMerchant(); }