torqnorth / pimcore-helpers-bundle
Package info
github.com/Torq-North/pimcore-helpers-bundle
Type:pimcore-bundle
pkg:composer/torqnorth/pimcore-helpers-bundle
Requires
- phpdocumentor/reflection-docblock: ^5.6
- pimcore/pimcore: ^11.0 || ^12.0
- symfony/serializer-pack: ^v1.3.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-11-24 15:51:17 UTC
README
A collection of several simple but commonly used, mockable service wrappers
AssetRepository: Service wrapper for fetching, saving and deleting assetscreateAsset(UploadedFile $upload, ElementInterface $parent, bool $overwrite = false, iterable $metadata = []): Creates and saves an asset from an UploadedFile, optionally including typedAssetMetadatavalues in its initial save.
FolderRepository: Service wrappers for either getting or getting/creating the three major folder types in pimcoreDataObjectRepository: Abstract service wrapper for saving/deleting data objectsArrayUtils: A collection of helper functions for deep parsing arrays as well as finding items within an arrayget(string|string[] $key, array $array): Navigates either one or a series of nested keys within an array and returns either the target value or null if any part of the chain does not exist. Several casting variations also exist which return specific types or null:getDate()getInt()getFloat()
findIndex(callable $callable, array $array)andfindInArray(callable $callable, array $array)functions, which find an item in an array based on a given function
Creating assets with metadata
createAsset() accepts any iterable containing TorqNorth\PimcoreHelpersBundle\Dto\AssetMetadata objects (including arrays, generators, and ArrayIterator). Metadata is added before the asset's initial save, so callers do not need to save the returned asset again just to persist metadata.
use TorqNorth\PimcoreHelpersBundle\Dto\AssetMetadata; $asset = $assetRepository->createAsset( $uploadedFile, $folder, metadata: [ new AssetMetadata('Legal', 'checkbox', true), new AssetMetadata('title', 'input', 'Example document', 'en'), ], );
Existing calls without metadata continue to work. The overwrite argument remains the third positional argument.
License
This bundle is licensed under the Pimcore Open Core License (POCL) and is intended for use with Pimcore Platform 2025.1 and newer.
See LICENSE.md for full license text.