77use Cake \ORM \Entity ;
88use Cake \ORM \Locator \LocatorAwareTrait ;
99use Cake \ORM \Table ;
10- use Cake \ORM \TableRegistry ;
1110use Cake \Utility \Hash ;
1211use Cake \Validation \Validator ;
1312use InvalidArgumentException ;
@@ -48,7 +47,7 @@ public function __construct($table, $options = [])
4847 */
4948 public function setTable ($ table )
5049 {
51- if (is_subclass_of ($ table , ' \Cake\ORM\Table ' )) {
50+ if (is_subclass_of ($ table , \Cake \ORM \Table::class )) {
5251 $ this ->table = $ table ;
5352 } else {
5453 $ this ->table = $ this ->getTableLocator ()->get ($ table );
@@ -75,7 +74,7 @@ protected function appendTokenValidator(Validator $validator)
7574 {
7675 $ tableName = $ this ->table ->getAlias ();
7776 $ type = $ this ->settings ['type ' ];
78- $ tokenTable = TableRegistry:: get ('Elastic/VerifyToken.Tokens ' );
77+ $ tokenTable = $ this -> getTableLocator ()-> get ('Elastic/VerifyToken.Tokens ' );
7978
8079 $ validator
8180 ->notEmptyString ('token ' , __ ('トークンは必ず入力してください。 ' ))
@@ -100,7 +99,7 @@ protected function appendTokenValidator(Validator $validator)
10099 public function getEntityByToken ($ token )
101100 {
102101 $ tokenTable = $ this ->getTableLocator ()->get ('Elastic/VerifyToken.Tokens ' );
103- $ foreignId = $ tokenTable ->getForeignIdByToken ($ token , $ this ->settings ['type ' ], $ this ->table ->alias ());
102+ $ foreignId = $ tokenTable ->getForeignIdByToken ($ token , $ this ->settings ['type ' ], $ this ->table ->getAlias ());
104103
105104 $ user = $ this ->table ->get ($ foreignId );
106105
@@ -121,7 +120,7 @@ public function getEntityByToken($token)
121120 public function validateToken ($ token )
122121 {
123122 $ tokenTable = $ this ->getTableLocator ()->get ('Elastic/VerifyToken.Tokens ' );
124- $ valid = $ tokenTable ->validateToken ($ token , $ this ->settings ['type ' ], $ this ->table ->alias ());
123+ $ valid = $ tokenTable ->validateToken ($ token , $ this ->settings ['type ' ], $ this ->table ->getAlias ());
125124 if (!$ valid ) {
126125 throw new InvalidArgumentException (__ ('無効なトークンです。 ' ));
127126 }
0 commit comments