mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 06:23:18 +00:00
Add delivery results to application settings page
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Model\Repositories;
|
||||
|
||||
use Alchemy\Phrasea\Model\Entities\ApiApplication;
|
||||
use Alchemy\Phrasea\Model\Entities\WebhookEventDelivery;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
@@ -22,6 +23,10 @@ use Doctrine\ORM\EntityRepository;
|
||||
*/
|
||||
class WebhookEventDeliveryRepository extends EntityRepository
|
||||
{
|
||||
|
||||
/**
|
||||
* @return WebhookEventDelivery[]
|
||||
*/
|
||||
public function findUndeliveredEvents()
|
||||
{
|
||||
$qb = $this->createQueryBuilder('e');
|
||||
@@ -34,4 +39,22 @@ class WebhookEventDeliveryRepository extends EntityRepository
|
||||
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ApiApplication $apiApplication
|
||||
* @param int $count
|
||||
* @return WebhookEventDelivery[]
|
||||
*/
|
||||
public function findLastDeliveries(ApiApplication $apiApplication, $count = 10)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('e');
|
||||
|
||||
$qb
|
||||
->where('e.application = :app')
|
||||
->setMaxResults(max(0, (int) $count))
|
||||
->orderBy('e.created', 'DESC')
|
||||
->setParameters([ 'app' => $apiApplication ]);
|
||||
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user