Browse Source

Свойство owner к ImageCollection

master
Alexander Demidov 11 years ago
parent
commit
dbd77177e1
  1. 9
      ImageCollection.class.php

9
ImageCollection.class.php

@ -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;

Loading…
Cancel
Save