Neos\Flow\ResourceManagement\ResourceManager::getCollectionsByStorage PHP Method

getCollectionsByStorage() public method

Returns an array of Collection instances which use the given storage
public getCollectionsByStorage ( Neos\Flow\ResourceManagement\Storage\StorageInterface $storage ) : array
$storage Neos\Flow\ResourceManagement\Storage\StorageInterface
return array
    public function getCollectionsByStorage(StorageInterface $storage)
    {
        $this->initialize();
        $collections = [];
        foreach ($this->collections as $collectionName => $collection) {
            /** @var CollectionInterface $collection */
            if ($collection->getStorage() === $storage) {
                $collections[$collectionName] = $collection;
            }
        }
        return $collections;
    }

Usage Example

 /**
  * Retrieve all Objects stored in this storage.
  *
  * @param callable $callback Function called after each iteration
  * @return \Generator<Object>
  */
 public function getObjects(callable $callback = null)
 {
     foreach ($this->resourceManager->getCollectionsByStorage($this) as $collection) {
         (yield $this->getObjectsByCollection($collection, $callback));
     }
 }