- BC Break: _PHP_ namespaces changed (PSR-4 standard). The _root_ namespace for all _PF_ related scripts is Exodus4D\Pathfinder
- BC Break: Project folder structure changed. Removed `app/main` dir. - BC Break: Core _PHP_ framework + dependencies moved into `composer.json` and are no longer part of this repo
This commit is contained in:
78
app/Model/Pathfinder/CharacterAuthenticationModel.php
Normal file
78
app/Model/Pathfinder/CharacterAuthenticationModel.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Exodus
|
||||
* Date: 25.04.2016
|
||||
* Time: 19:33
|
||||
*/
|
||||
|
||||
namespace Exodus4D\Pathfinder\Model\Pathfinder;
|
||||
|
||||
use DB\SQL\Schema;
|
||||
use Exodus4D\Pathfinder\Controller;
|
||||
|
||||
class CharacterAuthenticationModel extends AbstractPathfinderModel{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'character_authentication';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fieldConf = [
|
||||
'active' => [
|
||||
'type' => Schema::DT_BOOL,
|
||||
'nullable' => false,
|
||||
'default' => 1,
|
||||
'index' => true
|
||||
],
|
||||
'characterId' => [
|
||||
'type' => Schema::DT_INT,
|
||||
'index' => true,
|
||||
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\CharacterModel',
|
||||
'constraint' => [
|
||||
[
|
||||
'table' => 'character',
|
||||
'on-delete' => 'CASCADE'
|
||||
]
|
||||
]
|
||||
],
|
||||
'selector' => [
|
||||
'type' => Schema::DT_VARCHAR128,
|
||||
'nullable' => false,
|
||||
'default' => '',
|
||||
'index' => true,
|
||||
'unique' => true
|
||||
],
|
||||
'token' => [
|
||||
'type' => Schema::DT_VARCHAR128,
|
||||
'nullable' => false,
|
||||
'default' => '',
|
||||
'index' => true
|
||||
],
|
||||
'expires' => [
|
||||
'type' => Schema::DT_TIMESTAMP,
|
||||
'default' => Schema::DF_CURRENT_TIMESTAMP,
|
||||
'index' => true
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Event "Hook" function
|
||||
* can be overwritten
|
||||
* @param CharacterAuthenticationModel $self
|
||||
* @param $pkeys
|
||||
* @return bool
|
||||
*/
|
||||
public function beforeEraseEvent($self, $pkeys) : bool {
|
||||
// clear existing client Cookies as well
|
||||
$cookieName = Controller\Controller::COOKIE_PREFIX_CHARACTER;
|
||||
$cookieName .= '_' . $this->characterId->getCookieName();
|
||||
$self::getF3()->clear('COOKIE.' . $cookieName);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user