Neos\Flow\Persistence\Generic\DataMapper::mapSplObjectStorage PHP Method

mapSplObjectStorage() protected method

Maps an SplObjectStorage proxy record back to an SplObjectStorage
protected mapSplObjectStorage ( array $objectStorageValues = null, boolean $createLazySplObjectStorage = false ) : SplObjectStorage
$objectStorageValues array
$createLazySplObjectStorage boolean
return SplObjectStorage
    protected function mapSplObjectStorage(array $objectStorageValues = null, $createLazySplObjectStorage = false)
    {
        if ($objectStorageValues === null) {
            return new \SplObjectStorage();
        }
        if ($createLazySplObjectStorage) {
            $objectIdentifiers = [];
            foreach ($objectStorageValues as $arrayValue) {
                if ($arrayValue['value'] !== null) {
                    $objectIdentifiers[] = $arrayValue['value']['identifier'];
                }
            }
            return new LazySplObjectStorage($objectIdentifiers);
        } else {
            $objectStorage = new \SplObjectStorage();
            foreach ($objectStorageValues as $arrayValue) {
                if ($arrayValue['value'] !== null) {
                    $objectStorage->attach($this->mapToObject($arrayValue['value']));
                }
            }
            return $objectStorage;
        }
    }