Refactor VideoSerializationHandler for asset properties - #481
Refactor VideoSerializationHandler for asset properties#481dpfaffenbauer wants to merge 5 commits into
Conversation
Refactored video asset serialization to use private methods for duration, width, and height retrieval with error handling.
There was a problem hiding this comment.
Pull request overview
This PR refactors VideoSerializationHandler so that the duration, width, and height of a video asset are read through dedicated private methods that wrap the getter calls in try/catch and log errors instead of letting exceptions propagate during serialization. It follows the existing pattern already used by getImageThumbnail() in the same class.
Changes:
- Replace direct
$asset->getDuration()/getWidth()/getHeight()calls ingetAdditionalSystemFields()with calls to new private helpers. - Add
getDuration(),getWidth(), andgetHeight()helpers that catchExceptionand log a failure message.
Comments suppressed due to low confidence (1)
src/Service/Serializer/AssetTypeSerializationHandler/VideoSerializationHandler.php:109
$videois undefined here — the parameter of this method is named$asset. In the catch path this accesses an undefined variable and then callsgetId()onnull, which throws anErrorthat is not caught bycatch (Exception), so the error-logging path itself crashes. Use$asset->getId().
$video->getId() .
Updated error logging to use asset ID instead of video ID for consistency.
|
👋 Friendly reminder — this pull request is still a draft. A guardrail converted it to draft because something needed fixing, and there has been no activity since. If nothing changes, it will be closed in 14 days. To keep it open, just take one of these steps:
Closing is not rejection: the branch and the discussion stay, and the PR can be reopened at any time. When fixed, press Ready for review to re-run the checks. |
|



Refactored video asset serialization to use private methods for duration, width, and height retrieval with error handling.
Changes in this pull request
Resolves pimcore/platform-version#245
Additional info