|
|
@ -9,10 +9,11 @@ abstract class ImageCollection extends ArrayIterator |
|
|
|
|
|
|
|
/** |
|
|
|
* @param array|null $data |
|
|
|
* @param mixed $owner |
|
|
|
* @throws ErrorException |
|
|
|
* TODO: рефакторить этот метод |
|
|
|
*/ |
|
|
|
public function __construct($data = null) |
|
|
|
public function __construct($data = null, $owner = null) |
|
|
|
{ |
|
|
|
/** |
|
|
|
* @var $class Image |
|
|
@ -36,7 +37,11 @@ abstract class ImageCollection extends ArrayIterator |
|
|
|
ErrorMessage::log('Unable to fetch image "' . $original_filename . '" from ImageCollection.'); |
|
|
|
continue; |
|
|
|
} |
|
|
|
$this->append($class::getInstance($data['files'][$original_filename])); |
|
|
|
$image_instance = $class::getInstance($data['files'][$original_filename]); |
|
|
|
if ($owner) { |
|
|
|
$image_instance->setOwner($owner); |
|
|
|
} |
|
|
|
$this->append($image_instance); |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|