static function setUpColumns($columns) { $columns->userId = User::columns()->id; $columns->identityId = Identity::columns()->id; $columns->addedAt = Column::INTEGER + Column::UNSIGNED; $columns->priority = Column::INTEGER + Column::SIZE_1B; }
public static function findIdentity($login, $password) { $cols = Identity::columns(); /** @var Identity $identity */ $identity = Identity::statement()->where('? = ?', $cols->providerId, self::getProvider()->id)->where('? = ?', $cols->providerUserId, $login)->query()->fetchRow(); if (!$identity) { throw new \Exception('Identity not found'); } if ($identity->meta !== self::getPasswordHash($login, $password)) { throw new \Exception('Wrong password'); } return $identity; }
static function setUpColumns($columns) { $columns->identityId = Identity::columns()->id; $columns->token = Column::create(Column::STRING + Column::NOT_NULL)->setStringLength(32, true)->setUnique(); $columns->createdAt = Column::INTEGER; }