Exemplo n.º 1
0
 /**
  * Retrieve all Objects stored in this storage, filtered by the given collection name
  *
  * @param CollectionInterface $collection
  * @internal param string $collectionName
  * @return array<\TYPO3\Flow\Resource\Storage\Object>
  * @api
  */
 public function getObjectsByCollection(CollectionInterface $collection)
 {
     $objects = array();
     $that = $this;
     $bucketName = $this->bucketName;
     foreach ($this->resourceRepository->findByCollectionName($collection->getName()) as $resource) {
         /** @var \TYPO3\Flow\Resource\Resource $resource */
         $object = new Object();
         $object->setFilename($resource->getFilename());
         $object->setSha1($resource->getSha1());
         $object->setStream(function () use($that, $bucketName, $resource) {
             return fopen('s3://' . $bucketName . '/' . $this->keyPrefix . $resource->getSha1(), 'r');
         });
         $objects[] = $object;
     }
     return $objects;
 }
 /**
  * Retrieve all Objects stored in this storage, filtered by the given collection name
  *
  * @param CollectionInterface $collection
  * @return array<\TYPO3\Flow\Resource\Storage\Object>
  */
 public function getObjectsByCollection(CollectionInterface $collection)
 {
     $objects = array();
     $that = $this;
     foreach ($this->resourceRepository->findByCollectionName($collection->getName()) as $resource) {
         /** @var \TYPO3\Flow\Resource\Resource $resource */
         $object = new Object();
         $object->setFilename($resource->getFilename());
         $object->setSha1($resource->getSha1());
         $object->setMd5($resource->getMd5());
         $object->setFileSize($resource->getFileSize());
         $object->setStream(function () use($that, $resource) {
             return $that->getStreamByResource($resource);
         });
         $objects[] = $object;
     }
     return $objects;
 }
 /**
  * Retrieve all Objects stored in this storage, filtered by the given collection name
  *
  * @param CollectionInterface $collection
  * @internal param string $collectionName
  * @return array<\TYPO3\Flow\Resource\Storage\Object>
  * @api
  */
 public function getObjectsByCollection(CollectionInterface $collection)
 {
     if ($this->debug) {
         $this->systemLogger->log('storage ' . $this->name . ': getObjectsByCollection, $collection->getName(): ' . $collection->getName());
     }
     $objects = array();
     $that = $this;
     $containerName = $this->containerName;
     foreach ($this->resourceRepository->findByCollectionName($collection->getName()) as $resource) {
         /** @var \TYPO3\Flow\Resource\Resource $resource */
         if ($this->debug) {
             $this->systemLogger->log('storage ' . $this->name . ': - getObjectsByCollection $resource->getFilename(): ' . $resource->getFilename());
         }
         $object = new Object();
         $object->setFilename($resource->getFilename());
         $object->setSha1($resource->getSha1());
         $object->setStream(function () use($that, $containerName, $resource) {
             return 'http://' . $this->zoneDomain . '/_' . $resource->getSha1();
         });
         $objects[] = $object;
     }
     return $objects;
 }