Completed
Push — master ( 6af484...1f6893 )
by Tim
02:12
created

BackendController::getDifferentTypesAndLocations()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
/**
4
 * BackendController.
5
 */
6
declare(strict_types=1);
7
8
namespace HDNET\Calendarize\Controller;
9
10
use HDNET\Calendarize\Domain\Model\Index;
11
12
/**
13
 * BackendController.
14
 */
15
class BackendController extends AbstractController
16
{
17
18
    /**
19
     * Basic backend list.
20
     */
21
    public function listAction()
22
    {
23
        $this->settings['timeFormat'] = 'H:i';
24
        $this->settings['dateFormat'] = 'd.m.Y';
25
26
        $this->view->assignMultiple([
27
            'indices' => $this->indexRepository->findAll(),
28
            'typeLocations' => $this->getDifferentTypesAndLocations(),
29
            'settings' => $this->settings,
30
        ]);
31
    }
32
33
    /**
34
     * Get the differnet locations for new entries
35
     *
36
     * @return array
37
     */
38
    protected function getDifferentTypesAndLocations()
39
    {
40
        $typeLocations = [];
41
        foreach ($this->indexRepository->findDifferentTypesAndLocations() as $entry) {
42
            /** @var $entry Index */
43
            $typeLocations[$entry->getForeignTable()][$entry->getPid()] = $entry->getConfiguration()['uniqueRegisterKey'];
44
        }
45
        return $typeLocations;
46
    }
47
}
48