Сохраняем массив моделей.

@param  array|Collection  $data

@return Collection
431891
public function saveCollection($data): Collection
    {
        $items = collect();

        foreach ($data as $optionData) {
            $item = $this->save($optionData, (int) ($optionData['id'] ?? 0));

            $items->push($item);
        }

        return $items;
    }
1187690
public function toCollection() {
		$data  = iterator_to_array($this->_iterator);
		$model = $this->getModel();
		
		$collection = new Collection($data, $model);

		if ($this->hasDatagate()) {
			$collection->setDatagate($this->getDatagate());
		}
		
		if ($this->hasLocator()) {
			$collection->setLocator($this->getLocator());
		}
		
		return $collection;
	}
1081710
public function setData($data)
    {
        if (!$data instanceof CollectorInterface) {
            $data = new Collector($data);
        }

        $this->data = $data;

        return $this;
    }
336383
final public function fromArray(Array $data): self
    {
        foreach ($data as $key => $value) {
            $method = 'set' . ucfirst($key);

            if (method_exists($this, $method)) {
                $this->$method($value);
            }
        }

        return $this;
    }
300016
public function createCollection(array $data, array $options = [])
    {
        $this->setOptions($options);
        $coll = new Collection($this->client, $this->database);
        $coll->setHeaders($this->getHeaders());
        $rs = $coll->create($data);
        $this->checkResponse($rs);
        unset($rs['_curl_info']);

        return $rs;
    }
1068137
protected function convertToResource($data)
    {
        return Collection::make($this->client, $data->id)
            ->init($data);
    }
826027
public static function createFromArray(array $data)
    {
        $self = new self();

        if (isset($data['id'])) {
            $self->setId($data['id']);
        }
        if (isset($data['type'])) {
            $self->setType($data['type']);
        }
        if (isset($data['translated'])) {
            $self->setTranslated($data['translated']);
        }
        if (isset($data['flagged'])) {
            $self->setFlagged($data['flagged']);
        }
        if (isset($data['status'])) {
            $self->setStatus($data['status']);
        }
        if (isset($data['translation'])) {
            $self->setTranslation($data['translation']);
        }
        if (isset($data['revision'])) {
            $self->setRevision($data['revision']);
        }
        if (isset($data['comments'])) {
            $self->setComments($data['comments']);
        }
        if (isset($data['modified'])) {
            $self->setModified($data['modified']);
        }
        if (isset($data['author'])) {
            $self->setAuthor($data['author']);
        }
        if (isset($data['flagger'])) {
            $self->setFlagger($data['flagger']);
        }
        if (isset($data['locale'])) {
            $self->setLocale($data['locale']);
        }
        if (isset($data['plurals'])) {
            $self->setPlurals($data['plurals']);
        }

        return $self;
    }
595723
public function fromArray($data)
    {
        foreach ($data as $param => $value) {
            if (!method_exists($this, 'set' . ucfirst($param))) {
                continue;
            }
            $this->{'set' . ucfirst($param)}($value);
        }
        return $this;
    }
978457
protected function setDataToCollection(Collection $collection, $data)
    {
        // set parent
        if (!empty($data['parent'])) {
            $collectionEntity = $this->collectionRepository->findCollectionById($data['parent']);
            $collection->setParent($this->getApiEntity($collectionEntity, $data['locale']));
        }

        // set other data
        foreach ($data as $attribute => $value) {
            if ($value) {
                switch ($attribute) {
                    case 'title':
                        $collection->setTitle($value);
                        break;
                    case 'key':
                        $collection->setKey($value);
                        break;
                    case 'description':
                        $collection->setDescription($value);
                        break;
                    case 'style':
                        $collection->setStyle($value);
                        break;
                    case 'type':
                        if (!isset($value['id'])) {
                            break;
                        }
                        $type = $this->getTypeById($value['id']);
                        $collection->setType($type);
                        break;
                    case 'changer':
                        $collection->setChanger($value);
                        break;
                    case 'creator':
                        $collection->setCreator($value);
                        break;
                    case 'properties':
                        $collection->setProperties($value);
                        break;
                }
            }
        }

        return $collection;
    }
749342
public function toCollection($data): ICollection
	{
		if ($data instanceof QueryBuilder) {
			return new DbalCollection($this, $this->connection, $data);

		} elseif (is_array($data)) {
			$storageReflection = $this->getStorageReflection();
			$result = array_map([$this->getRepository(), 'hydrateEntity'], array_map([$storageReflection, 'convertStorageToEntity'], $data));
			return new ArrayCollection($result, $this->getRepository());

		} elseif ($data instanceof Result) {
			$result = [];
			$repository = $this->getRepository();
			$storageReflection = $this->getStorageReflection();
			foreach ($data as $row) {
				$result[] = $repository->hydrateEntity($storageReflection->convertStorageToEntity($row->toArray()));
			}
			return new ArrayCollection($result, $this->getRepository());
		}

		throw new InvalidArgumentException('DbalMapper can convert only array|QueryBuilder|Result to ICollection.');
	}
1094280
protected function createGenericCollectionFromMediaTypes($data = [])
    {
        $movieFactory = new MovieFactory($this->getHttpClient());
        $tvFactory    = new TvFactory($this->getHttpClient());
        $collection   = new GenericCollection();

        foreach ($data as $item) {
            switch ($item['media_type']) {
                case "movie":
                    $collection->add(null, $movieFactory->create($item));
                    break;

                case "tv":
                    $collection->add(null, $tvFactory->create($item));
                    break;

                default:
                    throw new \RuntimeException('Unknown media type "%s"', $item['media_type']);
            }
        }

        return $collection;
    }
1283800
public function mapCollectionReferences(array $data): array
    {
        $collectionReferences = [];

        foreach ($data as $dataItem) {
            $collectionReferences[] = CollectionReference::fromArray(
                [
                    'blockId' => (int) $dataItem['block_id'],
                    'blockStatus' => (int) $dataItem['block_status'],
                    'collectionId' => (int) $dataItem['collection_id'],
                    'collectionStatus' => (int) $dataItem['collection_status'],
                    'identifier' => $dataItem['identifier'],
                ]
            );
        }

        return $collectionReferences;
    }
98412
public function setMany(array $data)
    {
        foreach($data as $key => $value) {
            $this->_data[$key] = $value;
        }

        return $this;
    }
378243
public function createImageCollection(array $data = [])
    {
        $collection = new Images();

        foreach ($data as $format => $formatCollection) {

            if (!is_array($formatCollection)) {
                continue;
            }

            foreach ($formatCollection as $item) {
                if (array_key_exists($format, Image::$formats)) {
                    $item = $this->create($item, $format);

                    $collection->addImage($item);
                }
            }
        }

        return $collection;
    }
609699
public function createMany(): Collection
	{
		$collection = new Collection();

		foreach ($this->getInput() as $item) {
			$repository = clone $this;
			$repository->setInput($item);
			$collection->add($repository->create());
		}

		return $collection;
	}
366302
public function getMeLikes(array $data = [])
    {
        $response = $this->request->get("me/likes", $data);
        return new Collection($this->master, $response, "Pin");
    }
1103266
public static function createFromArray(array $data)
    {
        $self = new self();

        foreach ($data as $searchResult) {
            $self->addSearchResult(KeySearchResult::createFromArray($searchResult));
        }

        return $self;
    }