mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-12 23:08:41 +00:00
allow option overwrite in sort, with, limit
This commit is contained in:
parent
8c865bb0aa
commit
cd35204f03
|
|
@ -178,10 +178,26 @@ abstract class DataMapperAbstract
|
||||||
$split = \explode('/', $member);
|
$split = \explode('/', $member);
|
||||||
$memberSplit = \array_shift($split);
|
$memberSplit = \array_shift($split);
|
||||||
|
|
||||||
$this->sort[$memberSplit][] = [
|
$child = \implode('/', $split);
|
||||||
'child' => \implode('/', $split),
|
$overwritten = false;
|
||||||
'order' => $order,
|
|
||||||
];
|
if (isset($this->sort[$memberSplit])) {
|
||||||
|
foreach ($this->sort[$memberSplit] as $key => $element) {
|
||||||
|
if ($element['child'] === $child) {
|
||||||
|
$this->sort[$memberSplit][$key]['order'] = $order;
|
||||||
|
$overwritten = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$overwritten) {
|
||||||
|
$this->sort[$memberSplit][] = [
|
||||||
|
'child' => \implode('/', $split),
|
||||||
|
'order' => $order,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
@ -201,10 +217,26 @@ abstract class DataMapperAbstract
|
||||||
$split = \explode('/', $member);
|
$split = \explode('/', $member);
|
||||||
$memberSplit = \array_shift($split);
|
$memberSplit = \array_shift($split);
|
||||||
|
|
||||||
$this->offset[$memberSplit][] = [
|
$child = \implode('/', $split);
|
||||||
'child' => \implode('/', $split),
|
$overwritten = false;
|
||||||
'offset' => $offset,
|
|
||||||
];
|
if (isset($this->offset[$memberSplit])) {
|
||||||
|
foreach ($this->offset[$memberSplit] as $key => $element) {
|
||||||
|
if ($element['child'] === $child) {
|
||||||
|
$this->offset[$memberSplit][$key]['offset'] = $offset;
|
||||||
|
$overwritten = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$overwritten) {
|
||||||
|
$this->offset[$memberSplit][] = [
|
||||||
|
'child' => \implode('/', $split),
|
||||||
|
'offset' => $offset,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
@ -224,10 +256,26 @@ abstract class DataMapperAbstract
|
||||||
$split = \explode('/', $member);
|
$split = \explode('/', $member);
|
||||||
$memberSplit = \array_shift($split);
|
$memberSplit = \array_shift($split);
|
||||||
|
|
||||||
$this->limit[$memberSplit][] = [
|
$child = \implode('/', $split);
|
||||||
'child' => \implode('/', $split),
|
$overwritten = false;
|
||||||
'limit' => $limit,
|
|
||||||
];
|
if (isset($this->limit[$memberSplit])) {
|
||||||
|
foreach ($this->limit[$memberSplit] as $key => $element) {
|
||||||
|
if ($element['child'] === $child) {
|
||||||
|
$this->limit[$memberSplit][$key]['limit'] = $limit;
|
||||||
|
$overwritten = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$overwritten) {
|
||||||
|
$this->limit[$memberSplit][] = [
|
||||||
|
'child' => \implode('/', $split),
|
||||||
|
'limit' => $limit,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user