Fetch cases

In order to fetch cases from CXM you have to use the CaseManager class.

Fetch a single case

If you want to fetch a single case, use the getCase method on CaseManager, passing it a case reference.

<?php

$caseReference = 'REF123456'; // Reference of an existing case.

/** @var \Jadu\Quantum\ServiceApiClient\Manager\CaseManager $caseManager */
$caseManager = $container->get('quantum_service_api_client.manager.case');

/** @var \Jadu\Quantum\ServiceApiClient\Model\CaseHeader $case */
$case = $caseManager->getCase($caseReference);

Fetch all cases of a type

If you want to fetch all cases of a type, use the getAllByCaseType method on CaseManager, passing it a case type name.

<?php

$caseTypeName = 'complaint'; // Name of the CaseType for the cases you want to fetch.

/** @var \Jadu\Quantum\ServiceApiClient\Manager\CaseManager $caseManager */
$caseManager = $container->get('quantum_service_api_client.manager.case');

/** @var \Jadu\Quantum\ServiceApiClient\Model\Collection\PaginatedCollection $cases */
$cases = $caseManager->getAllByCaseType($caseTypeName);

The method getAllByCaseType returns a PaginatedCollection and you can add specific pagination parameters to it.
By default, it will return the first page, including 15 cases per page.

<?php

$caseTypeName = 'complaint';
$page = 3; // The page you want to fetch.
$perPage = 50; // The no. of cases included per page.

/** @var \Jadu\Quantum\ServiceApiClient\Manager\CaseManager $caseManager */
$caseManager = $container->get('quantum_service_api_client.manager.case');

/** @var \Jadu\Quantum\ServiceApiClient\Model\Collection\PaginatedCollection $cases */
$cases = $caseManager->getAllByCaseType($caseTypeName, $page, $perPage);

Fetch a list of summaries of cases that match a filter

If you want to fetch a summary of all cases that match a filter, use the getAllSummariesByFilterSet method on CaseManager, passing it a filter set name.

<?php

$filterSetName = 'my-cases'; // Name of the CaseFilterSet for the cases you want to fetch.

/** @var \Jadu\Quantum\ServiceApiClient\Manager\CaseManager $caseManager */
$caseManager = $container->get('quantum_service_api_client.manager.case');

/** @var \Jadu\Quantum\ServiceApiClient\Model\Collection\PaginatedCollection|\Jadu\Quantum\ServiceApiClient\Model\CaseSummary[] $cases */
$cases = $caseManager->getAllSummariesByFilterSet($filterSetName);

The method getAllSummariesByFilterSet returns a PaginatedCollection and you can add specific pagination parameters to it. By default, it will return the first page, including 15 cases per page.

<?php

$filterSetName = 'my-cases';
$page = 3; // The page you want to fetch.
$perPage = 50; // The no. of cases included per page.

/** @var \Jadu\Quantum\ServiceApiClient\Manager\CaseManager $caseManager */
$caseManager = $container->get('quantum_service_api_client.manager.case');

/** @var \Jadu\Quantum\ServiceApiClient\Model\Collection\PaginatedCollection|\Jadu\Quantum\ServiceApiClient\Model\CaseSummary[] $cases */
$cases = $caseManager->getAllSummariesByFilterSet($filterSetName, $page, $perPage);

var_dump($cases[0]->getColumns()[0]->getRenderedText()); // Prints eg. 'My rendered Twig'

results matching ""

    No results matching ""