Свойство owner к ImageCollection

This commit is contained in:
Alexander Demidov
2014-01-13 12:35:07 +04:00
parent f3cbfb0969
commit dbd77177e1

View File

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