Files
mautic-marketing-program-bu…/Entity/InitiativeRepository.php
T
Alexandre Gain 71ff11390b refactor(plugin): rename Plan to Program and add audience/UTM routes
Rename the Plan bundle to Program across config, routes, menus, and
controllers (Plan -> Initiative), bump version to 0.16.0, and introduce
new audience and UTM taxonomy routes and permissions to support the
expanded Programs feature set.
2026-11-13 22:01:32 +01:00

58 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
/**
* @extends CommonRepository<Initiative>
*/
class InitiativeRepository extends CommonRepository
{
public function getTableAlias(): string
{
return 'p';
}
/**
* Loads the owner and category with the plans, so that the list doesn't query them one by one.
*
* @param array<string, mixed> $args
*/
public function getEntities(array $args = [])
{
$alias = $this->getTableAlias();
$args['qb'] = $this->createQueryBuilder($alias)
->select($alias, 'o', 'c')
->leftJoin($alias.'.owner', 'o')
->leftJoin($alias.'.category', 'c');
return parent::getEntities($args);
}
/**
* The list's search box matches the name.
*
* @return array<int, mixed>
*/
protected function addCatchAllWhereClause($q, $filter): array
{
return $this->addStandardCatchAllWhereClause($q, $filter, [
$this->getTableAlias().'.name',
]);
}
/**
* @return array<array{0: string, 1: string}>
*/
protected function getDefaultOrder(): array
{
return [
[$this->getTableAlias().'.name', 'ASC'],
];
}
}