/** * @param $uuid * @return Tool\UUID */ public function getByUuid($uuid) { $data = $this->db->fetchRow("SELECT * FROM " . self::TABLE_NAME . " where uuid='" . $uuid . "'"); $model = new Model\Tool\UUID(); $model->setValues($data); return $model; }
/** * @param $e */ public function deleteUuid($e) { $uuidObject = UUID::getByItem($e->getTarget()); if ($uuidObject instanceof UUID) { $uuidObject->delete(); } }
/** * Loads a list of Email_Log for the specified parameters, returns an array of Email_Log elements * * @return array */ public function load() { $items = $this->db->fetchCol("SELECT uuid FROM " . Resource::TABLE_NAME . " " . $this->getCondition() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables()); $result = array(); foreach ($items as $uuid) { $result[] = UUID::getByUuid($uuid); } return $result; }
/** * @return mixed * @throws \Exception */ public function createUuid() { if (!$this->getInstanceIdentifier()) { throw new \Exception("No instance identifier specified."); } $uuid = \UUID::generate(\UUID::UUID_NAME_SHA1, \UUID::FMT_STRING, $this->getUuidResourceName(), $this->getInstanceIdentifier()); return $uuid; }
\Pimcore::getEventManager()->attach(["admin.object.get.preSendData", "admin.asset.get.preSendData", "admin.document.get.preSendData"], ["\\Pimcore\\WorkflowManagement\\EventHandler", "adminElementGetPreSendData"]); // backed search foreach (["asset", "object", "document"] as $type) { \Pimcore::getEventManager()->attach($type . ".postAdd", ["Pimcore\\Search\\EventHandler", "postAddElement"]); \Pimcore::getEventManager()->attach($type . ".postUpdate", ["Pimcore\\Search\\EventHandler", "postUpdateElement"]); \Pimcore::getEventManager()->attach($type . ".preDelete", ["Pimcore\\Search\\EventHandler", "preDeleteElement"]); } // UUID $conf = \Pimcore\Config::getSystemConfig(); if ($conf->general->instanceIdentifier) { foreach (["asset", "object", "document", "object.class"] as $type) { \Pimcore::getEventManager()->attach($type . ".postAdd", function ($e) { \Pimcore\Model\Tool\UUID::create($e->getTarget()); }); \Pimcore::getEventManager()->attach($type . ".postDelete", function ($e) { $uuidObject = \Pimcore\Model\Tool\UUID::getByItem($e->getTarget()); if ($uuidObject instanceof \Pimcore\Model\Tool\UUID) { $uuidObject->delete(); } }); } } //assign tags after copying an element Pimcore::getEventManager()->attach(["document.postCopy", "asset.postCopy", "object.postCopy"], function (\Zend_EventManager_Event $e) { $elementType = strtok($e->getName(), '.'); /** @var \Pimcore\Model\Element\AbstractElement $copiedElement */ $copiedElement = $e->getTarget(); /** @var \Pimcore\Model\Element\AbstractElement $baseElement */ $baseElement = $e->getParam('base_element'); \Pimcore\Model\Element\Tag::setTagsForElement($elementType, $copiedElement->getId(), \Pimcore\Model\Element\Tag::getTagsForElement($elementType, $baseElement->getId())); });