/** * Assign the product and the loaded file to an image instance * * @param Product $product The product to assign to the image * @param File\File $file The loaded file to assign to the image * @param array $options The product options to assign to the image * @param string $type The type to set against the image * @throws \InvalidArgumentException Throws exception if $type is not a string * * @return Image Returns a new Image instance with the product and file assigned */ private function _setProductToImage(Product $product, File\File $file, array $options, $type) { if (!is_string($type)) { throw new \InvalidArgumentException('Image type must be a string, ' . gettype($type) . ' given'); } $image = new Image(); $image->setFileLoader($this->_fileLoader); $image->product = $product; $image->fileID = $file->id; $image->locale = $this->_locale; $image->options = $options; $image->type = $type; return $image; }
public function getFile() { $this->_loadFile(); return parent::getFile(); }