浏览代码

Refactor tokens.

mscherer 5 年之前
父节点
当前提交
17449a9c01
共有 1 个文件被更改,包括 16 次插入1 次删除
  1. 16 1
      src/Model/Entity/Token.php

+ 16 - 1
src/Model/Entity/Token.php

@@ -7,7 +7,7 @@ namespace Tools\Model\Entity;
  * @property int $user_id
  * @property string $type
  * @property string $token_key
- * @property-read string $key
+ * @property string $key Deprecated, use token_key instead.
  * @property string $content
  * @property int $used
  * @property \Cake\I18n\Time $created
@@ -29,4 +29,19 @@ class Token extends Entity {
 		return $this->token_key;
 	}
 
+	/**
+	 * Shim to allow ->key access for ->token_key.
+	 *
+	 * @deprecated Use token_key instead.
+	 *
+	 * @param string|null $key
+	 *
+	 * @return void
+	 */
+	public function _setKey(?string $key): void {
+		trigger_error('Deprecated. Use ->token_key instead.', E_USER_DEPRECATED);
+
+		$this->token_key = $key;
+	}
+
 }