Spaces:
No application file
No application file
File size: 1,289 Bytes
d2897cd |
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 Mautic\PluginBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
/**
* @extends CommonRepository<Plugin>
*/
class PluginRepository extends CommonRepository
{
/**
* Find an addon record by bundle name.
*
* @param string $bundle
*
* @return mixed
*
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public function findByBundle($bundle)
{
$q = $this->createQueryBuilder($this->getTableAlias());
$q->where($q->expr()->eq('p.bundle', ':bundle'))
->setParameter('bundle', $bundle);
return $q->getQuery()->getOneOrNullResult();
}
public function getEntities(array $args = [])
{
$q = $this->_em->createQueryBuilder();
$q->select($this->getTableAlias())
->from(Plugin::class, $this->getTableAlias(), (!empty($args['index'])) ? $this->getTableAlias().'.'.$args['index'] : $this->getTableAlias().'.id');
$args['qb'] = $q;
$args['ignore_paginator'] = true;
return parent::getEntities($args);
}
protected function getDefaultOrder(): array
{
return [
['p.name', 'ASC'],
];
}
public function getTableAlias(): string
{
return 'p';
}
}
|