Inheritance: extends Pimcore\Model\AbstractModel
コード例 #1
0
ファイル: Dao.php プロジェクト: ChristophWurst/pimcore
 /**
  * @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;
 }
コード例 #2
0
ファイル: Module.php プロジェクト: emanuel-london/pimcore
 /**
  * @param $e
  */
 public function deleteUuid($e)
 {
     $uuidObject = UUID::getByItem($e->getTarget());
     if ($uuidObject instanceof UUID) {
         $uuidObject->delete();
     }
 }
コード例 #3
0
ファイル: Resource.php プロジェクト: rolandstoll/pimcore
 /**
  * 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;
 }
コード例 #4
0
ファイル: UUID.php プロジェクト: Gerhard13/pimcore
 /**
  * @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;
 }
コード例 #5
0
ファイル: event-listeners.php プロジェクト: pimcore/pimcore
\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()));
});