code: protected function createPhotosCollection(Product $product, $values)
      {
          $photos      = new ArrayCollection();
          $identifiers = $this->getMediaIdentifiers($values);
          $hierarchy   = 0;
          
          foreach ($identifiers as $id) {
              $media = $this->getMediaById($id);
              $photo = $this->getProductPhoto($media, $product, $values);
              $photo->setHierarchy($hierarchy++);
              if (!$photos->contains($photo)) {
                  $photos->add($photo);
              }
          }
          
          return $photos;
      }
docs: Returns new photos collection
  
  @param Product $product
  @param array   $values
  
  @return ArrayCollection