public static function lock($cid, $ctype) { // try to get user if (!($user = Pimcore_Tool_Admin::getCurrentUser())) { return false; } $lock = new self(); $lock->setCid($cid); $lock->setCtype($ctype); $lock->setDate(time()); $lock->setUserId($user->getId()); $lock->setSessionId(session_id()); $lock->save(); return $lock; }
public static function lock($cid, $ctype) { // try to get user try { $user = Zend_Registry::get("pimcore_admin_user"); } catch (Exception $e) { return false; } $lock = new self(); $lock->setCid($cid); $lock->setCtype($ctype); $lock->setDate(time()); $lock->setUserId($user->getId()); $lock->setSessionId(session_id()); $lock->save(); return $lock; }
/** * {@inheritdoc} */ public static function fromArray(array $values) { $message = new self(); $values = array_merge(['ctype' => \google\protobuf\FieldOptions\CType::STRING(), 'packed' => null, 'jstype' => \google\protobuf\FieldOptions\JSType::JS_NORMAL(), 'lazy' => false, 'deprecated' => false, 'weak' => false, 'uninterpreted_option' => []], $values); $message->setCtype($values['ctype']); $message->setPacked($values['packed']); $message->setJstype($values['jstype']); $message->setLazy($values['lazy']); $message->setDeprecated($values['deprecated']); $message->setWeak($values['weak']); foreach ($values['uninterpreted_option'] as $item) { $message->addUninterpretedOption($item); } return $message; }