public function __construct(array $params = array(), array $listingsProducts) { if (count($listingsProducts) == 0) { throw new Exception('Multiple Item Connector has received empty array'); } foreach ($listingsProducts as $listingProduct) { if (!$listingProduct instanceof Ess_M2ePro_Model_Listing_Product) { throw new Exception('Multiple Item Connector has received invalid product data type'); } } $tempListing = $listingsProducts[0]->getListing(); foreach ($listingsProducts as $listingProduct) { if ($tempListing->getId() != $listingProduct->getListing()->getId()) { throw new Exception('Multiple Item Connector has received products from different listings'); } } $this->listingsProducts = $listingsProducts; parent::__construct($params, $tempListing); }
public function __construct(array $params = array(), Ess_M2ePro_Model_Listing_Product $listingProduct) { $this->listingProduct = $listingProduct; parent::__construct($params, $this->listingProduct->getListing()); }