mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-17 04:18:41 +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_email' => ['name' => 'account_email', 'type' => 'string', 'internal' => 'email'],
|
||||
'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 = [
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ class Request extends RequestAbstract
|
|||
{
|
||||
if (!isset($this->uri)) {
|
||||
$this->initCurrentRequest();
|
||||
$this->lock();
|
||||
}
|
||||
|
||||
$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->setupUriBuilder();
|
||||
$this->createRequestHashs();
|
||||
$this->lock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -214,39 +213,30 @@ class Request extends RequestAbstract
|
|||
/**
|
||||
* 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
|
||||
*
|
||||
* @todo: maybe change to normal path string e.g. /some/path/here instead of hash! Remember to adjust navigation elements
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function createRequestHashs() /* : void */
|
||||
public function createRequestHashs(int $start = 0) /* : void */
|
||||
{
|
||||
$this->hash = [];
|
||||
foreach ($this->path as $key => $path) {
|
||||
$paths = [];
|
||||
for ($i = 0; $i < $key + 1; $i++) {
|
||||
for ($i = $start; $i < $key + 1; $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
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user