mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-08 13:28:39 +00:00
Test fixes (working)
This commit is contained in:
parent
20a48cc1fe
commit
082a493cc7
|
|
@ -40,7 +40,7 @@ class AccountMapper extends DataMapperAbstract
|
||||||
'account_name3' => ['name' => 'account_name3', 'type' => 'string', 'internal' => 'name3'],
|
'account_name3' => ['name' => 'account_name3', 'type' => 'string', 'internal' => 'name3'],
|
||||||
'account_email' => ['name' => 'account_email', 'type' => 'string', 'internal' => 'email'],
|
'account_email' => ['name' => 'account_email', 'type' => 'string', 'internal' => 'email'],
|
||||||
'account_lactive' => ['name' => 'account_lactive', 'type' => 'DateTime', 'internal' => 'lastActive'],
|
'account_lactive' => ['name' => 'account_lactive', 'type' => 'DateTime', 'internal' => 'lastActive'],
|
||||||
'account_created_at' => ['name' => 'account_created', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
'account_created_at' => ['name' => 'account_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
||||||
];
|
];
|
||||||
|
|
||||||
protected static $hasMany = [
|
protected static $hasMany = [
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ class Request extends RequestAbstract
|
||||||
{
|
{
|
||||||
if (!isset($this->uri)) {
|
if (!isset($this->uri)) {
|
||||||
$this->initCurrentRequest();
|
$this->initCurrentRequest();
|
||||||
|
$this->lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->data = array_change_key_case($this->data, CASE_LOWER);
|
$this->data = array_change_key_case($this->data, CASE_LOWER);
|
||||||
|
|
@ -112,8 +113,6 @@ class Request extends RequestAbstract
|
||||||
$this->path = explode('/', $this->uri->getPath());
|
$this->path = explode('/', $this->uri->getPath());
|
||||||
|
|
||||||
$this->setupUriBuilder();
|
$this->setupUriBuilder();
|
||||||
$this->createRequestHashs();
|
|
||||||
$this->lock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -214,39 +213,30 @@ class Request extends RequestAbstract
|
||||||
/**
|
/**
|
||||||
* Create request hashs of current request
|
* Create request hashs of current request
|
||||||
*
|
*
|
||||||
|
* The hashes are based on the request path and can be used as unique id.
|
||||||
|
*
|
||||||
|
* @param int $start Start hash from n-th path element
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
* @todo: maybe change to normal path string e.g. /some/path/here instead of hash! Remember to adjust navigation elements
|
||||||
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
*/
|
*/
|
||||||
private function createRequestHashs() /* : void */
|
public function createRequestHashs(int $start = 0) /* : void */
|
||||||
{
|
{
|
||||||
$this->hash = [];
|
$this->hash = [];
|
||||||
foreach ($this->path as $key => $path) {
|
foreach ($this->path as $key => $path) {
|
||||||
$paths = [];
|
$paths = [];
|
||||||
for ($i = 0; $i < $key + 1; $i++) {
|
for ($i = $start; $i < $key + 1; $i++) {
|
||||||
$paths[] = $this->path[$i];
|
$paths[] = $this->path[$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->hash[] = $this->hashRequest($paths);
|
$this->hash[] = sha1(implode('', $paths));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate request hash.
|
|
||||||
*
|
|
||||||
* @param array $request Request array
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
private function hashRequest(array $request) : string
|
|
||||||
{
|
|
||||||
return sha1(implode('', $request));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is Mobile
|
* Is Mobile
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user