*/ class WorkflowMapper extends QBMapper { public function __construct(IDBConnection $db) { parent::__construct($db, 'wfda_workflows', Workflow::class); } /** * @throws DoesNotExistException * @throws MultipleObjectsReturnedException */ public function findById(int $id): Workflow { $qb = $this->db->getQueryBuilder(); $qb->select('*') ->from($this->getTableName()) ->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT))); return $this->findEntity($qb); } /** * @param int[] $boardIds * @return Workflow[] */ public function findAllForBoards(array $boardIds): array { if ($boardIds === []) { return []; } $qb = $this->db->getQueryBuilder(); $qb->select('*') ->from($this->getTableName()) ->where($qb->expr()->in('board_id', $qb->createNamedParameter($boardIds, IQueryBuilder::PARAM_INT_ARRAY))) ->orderBy('id', 'ASC'); return $this->findEntities($qb); } /** * @return Workflow[] */ public function findAllEnabled(): array { $qb = $this->db->getQueryBuilder(); $qb->select('*') ->from($this->getTableName()) ->where($qb->expr()->eq('enabled', $qb->createNamedParameter(true, IQueryBuilder::PARAM_BOOL))) ->orderBy('user_id', 'ASC') ->addOrderBy('id', 'ASC'); return $this->findEntities($qb); } }