This repository has been archived on 2026-07-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
espocrm-base/application/Espo/Core/SelectManager.php
T
Yuri Kuznetsov fa72ef74f5 dev
2013-12-26 17:26:55 +02:00

47 lines
938 B
PHP

<?php
namespace Espo\Core;
use \Espo\Core\Exceptions\Error;
class SelectManager
{
protected $container;
protected $user;
protected $acl;
public function __construct(ORM\EntityManager $entityManager, \Espo\Entities\User $user, Acl $acl)
{
$this->entityManager = $entityManager;
$this->user = $user;
$this->acl = $acl;
}
public function getSelectParams($entityName, array $params, $withAcl = false)
{
$result = array();
if (!empty($params['sortBy'])) {
$result['orderBy'] = $params['sortBy'];
}
if (isset($params['asc'])) {
if ($params['asc']) {
$result['order'] = 'ASC';
} else {
$result['order'] = 'DESC';
}
}
if (isset($params['offset']) && !is_null($params['offset'])) {
$result['offset'] = $params['offset'];
}
if (isset($params['maxSize']) && !is_null($params['maxSize'])) {
$result['limit'] = $params['maxSize'];
}
return $result;
}
}