/
ExpressEntryListPagerManager.php
54 lines (43 loc) · 1.27 KB
/
ExpressEntryListPagerManager.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace Concrete\Core\Search\ItemList\Pager\Manager;
use Concrete\Core\Entity\Express\Entity;
use Concrete\Core\Entity\Express\Entry;
use Concrete\Core\Express\ObjectManager;
use Concrete\Core\Page\Search\ColumnSet\Available;
use Concrete\Core\Search\ItemList\ItemList;
use Concrete\Core\Search\ItemList\Pager\PagerProviderInterface;
class ExpressEntryListPagerManager extends AbstractPagerManager
{
/**
* @var Entity
*/
protected $entity;
public function __construct(Entity $entity, ItemList $itemList)
{
$this->entity = $entity;
parent::__construct($itemList);
}
/**
* @param $mixed Entry
* @return mixed
*/
public function getCursorStartValue($mixed)
{
return $mixed->getID();
}
public function getCursorObject($cursor)
{
$entry = app(ObjectManager::class)->getEntry($cursor);
if ($entry) {
return $entry;
}
}
public function getAvailableColumnSet()
{
return new \Concrete\Core\Express\Search\ColumnSet\Available($this->entity->getAttributeKeyCategory());
}
public function sortListByCursor(PagerProviderInterface $itemList, $direction)
{
$itemList->getQueryObject()->addOrderBy('e.exEntryID', $direction);
}
}