Skip to content

Instantly share code, notes, and snippets.

@brusch
Created October 5, 2016 11:56
Show Gist options
  • Save brusch/28322b1299f4330c519de837bbfb6d41 to your computer and use it in GitHub Desktop.
Save brusch/28322b1299f4330c519de837bbfb6d41 to your computer and use it in GitHub Desktop.
<?php
\Pimcore::getEventManager()->attach("admin.controller.postInit", function ($event) {
$controller = $event->getTarget();
if($controller->getParam("controller") == "object" && $controller->getParam("action") == "update") {
$object = \Pimcore\Model\Object::getById($controller->getParam("id"));
// do with the object whatever you want
// later in ObjectController::updateAction() the pimcore admin will get the same instance of this object
// since ::getById() returns always the same object for an ID
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment