Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
ResultServiceWrapper
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 2
20
0.00% covered (danger)
0.00%
0 / 1
 getService
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 deleteResultCache
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3/**
4 * Created by PhpStorm.
5 * User: christophe
6 * Date: 20/06/17
7 * Time: 15:11
8 */
9
10namespace oat\taoOutcomeUi\model\Wrapper;
11
12use oat\oatbox\service\ConfigurableService;
13use oat\oatbox\service\ServiceManager;
14use oat\taoDelivery\model\execution\DeliveryExecutionInterface;
15use oat\taoDelivery\models\classes\execution\event\DeliveryExecutionState;
16use oat\taoOutcomeUi\model\ResultsService;
17
18class ResultServiceWrapper extends ConfigurableService
19{
20    public const SERVICE_ID  = 'taoOutcomeUi/resultService';
21
22    public const RESULT_COLUMNS_CHUNK_SIZE_OPTION = 'resultColumnsChunkSize';
23    /**
24     * @var ResultsService
25     */
26    protected $resultService;
27
28    public function getService()
29    {
30        if (is_null($this->resultService)) {
31            $serviceClass = $this->getOption('class');
32            $this->resultService = $serviceClass::singleton();
33        }
34        return $this->resultService;
35    }
36
37    public static function deleteResultCache(DeliveryExecutionState $event)
38    {
39        // if the delivery execution has been re-activated, we have to delete the result cache already existing for this
40        // execution
41        if ($event->getPreviousState() == DeliveryExecutionInterface::STATE_FINISHIED) {
42            /** @var ResultsService $resultService */
43            $resultService = ServiceManager::getServiceManager()->get(self::SERVICE_ID)->getService();
44            $resultService->deleteCacheFor($event->getDeliveryExecution()->getIdentifier());
45        }
46    }
47}