Skip to content

Select Manager

Important: Deprecated as of v6.1.0. Use Select Builder instead.

Select Manager can be utilized for generating and managing select params which subsequently will be feed to ORM.

Base class: Base.php.

Usage example:

$selectManager = $selectManagerFactory->create('Opportunity');
$params = $selectManager->getEmptySelectParams();

$selectManager->applyAccess($params); // add ACL $params
$selectManager->applyPrimaryFilter('open', $params);
$selectManager->applyOrder('createdAt', true, $params);
$selectManager->applyLimit(0, 5, $params);

$params['whereClause'][] = [
    'accountId' => $accountId,


Creating an instance of Select Manager

$selectManager = $container->get('selectManagerFactory')->create($entityType);

For a specific user, to be able to apply ACL specific to the user.

$selectManager = $container->get('selectManagerFactory')->create($entityType, $user);

Generating empty select params

$params = $selectManager->getEmptySelectParams();

Applying ACL


Primary filter

$selectManager->applyPrimaryFilter($filterName, $params);

Bool filter

$selectManager->applyBoolFilter($filterName, $params);


$selectManager->setDistinct(true, $params);

Add Join

], $params);
    'TableName', // table name in CamelCase
    'someAlias', // alias for our join
        'someAlias.meetingId:' => 'id', // additional join condition
], $params);

Add Left Join

], $params);

Custom Select Manager

How to extend an existing select manager for a specific entity type.

Example for Account. There is already extended class in application/Espo/Modules/Crm/SelectManagers/Account.php, so we need to extend from it.

Create a file custom/Espo/Custom/SelectManager/Account.php:

namespace Espo\Custom\SelectManagers;

class Account extends \Espo\Modules\Crm\SelectManagers\Account
    protected function filterMyCustomFilter(&$result)
        $result['whereClause'][] = [
            'someAttribute' => 'Some Value',

If there's no select manager class for a specific entity type, you need to extend from \Espo\Core\SelectManagers\Base.