Add delivery results to application settings page

This commit is contained in:
Thibaud Fabre
2016-10-13 14:05:53 +02:00
parent 981e55f026
commit e77178d757
9 changed files with 341 additions and 19 deletions

View File

@@ -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();
}
}