Closed alexmarkop closed 19 hours ago
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
I have read the CLA Document and I hereby sign the CLA
Hello @alexmarkop ,
could you please provide steps to reproduce the problem?
What I did was:
Seems to be working for me. Did I miss something?
Hi @mcop1 ,
The issue was introduced by this commit:
https://github.com/pimcore/admin-ui-classic-bundle/commit/80498edfb3474802da12834c871e0898bfccca81
file public/js/pimcore/object/tags/abstractRelations.js
line 212:
delete context.objectId;
Take a look at the code snippet in the following example (Asset Upload Path): https://pimcore.com/docs/platform/Pimcore/Extending_Pimcore/Event_API_and_Event_Manager/#asset-upload-path
\Pimcore::getEventDispatcher()->addListener(AssetEvents::RESOLVE_UPLOAD_TARGET,
function(\Pimcore\Event\Model\Asset\ResolveUploadTargetEvent $event) {
$context = $event->getContext();
if ($context["containerType"] == "object") {
$objectId = $context["objectId"];
$newsObject = News::getById($objectId);
if ($newsObject) {
$fieldname = $context["fieldname"];
$targetPath = $newsObject->getPath() . $newsObject->getKey() . "/" . $fieldname;
$parent = \Pimcore\Model\Asset\Service::createFolderByPath($targetPath);
if ($parent) {
$event->setParentId($parent->getId());
}
}
}
});
now $context["objectId"]
is not available anymore causing the example above to throw an error.
Thanks again for the fix!
Cherry picked to 1.6 with 77e046ab209a7273e1988b57e0902560837000af
This code change fixes the mistaken deletion of "objectId" from "this.context".
Without this, the following example is broken: https://pimcore.com/docs/platform/Pimcore/Extending_Pimcore/Event_API_and_Event_Manager/#asset-upload-path