1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* FlexiPeeHP - Objekt Žurnálu. |
4
|
|
|
* |
5
|
|
|
* @author Vítězslav Dvořák <[email protected]> |
6
|
|
|
* @copyright (C) 2017 Spoje.Net |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace FlexiPeeHP; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Žurnál změn |
13
|
|
|
* Journal of Changes |
14
|
|
|
* |
15
|
|
|
* @link https://demo.flexibee.eu/c/demo/adresar/properties položky evidence |
16
|
|
|
*/ |
17
|
|
|
class Zurnal extends FlexiBeeRO |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* Evidence užitá objektem. |
21
|
|
|
* |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
public $evidence = 'zurnal'; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* |
28
|
|
|
* @var type |
|
|
|
|
29
|
|
|
*/ |
30
|
|
|
public static $evidenceToDb = ['faktura-vydana' => 'ddoklfak']; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* obtain all record changes array |
34
|
|
|
* |
35
|
|
|
* Note: Do not use this method in production environment! |
36
|
|
|
* |
37
|
|
|
* If you have no other choice pleas add indexes into wzurnal |
38
|
|
|
* postgesql table: |
39
|
|
|
* |
40
|
|
|
* CREATE INDEX CONCURRENTLY tname_index ON wzurnal (tabulka); |
41
|
|
|
* CREATE INDEX CONCURRENTLY rid_index ON wzurnal (idZaznamu); |
42
|
|
|
* |
43
|
|
|
* @param FlexiBeeRO $object |
44
|
|
|
* @return array changes history |
45
|
|
|
*/ |
46
|
|
|
public function getAllChanges($object) |
47
|
|
|
{ |
48
|
|
|
$changesArray = []; |
49
|
|
|
|
50
|
|
|
$evidence = $object->getEvidence(); |
51
|
|
|
if (array_key_exists($evidence, self::$evidenceToDb)) { |
|
|
|
|
52
|
|
|
$dbTable = self::$evidenceToDb[$evidence]; |
53
|
|
|
$changes = $this->getColumnsFromFlexibee('*', |
|
|
|
|
54
|
|
|
['tabulka' => $dbTable, 'idZaznamu' => $object->getMyKey()]); |
55
|
|
|
|
56
|
|
|
foreach ($changes as $change) { |
57
|
|
|
$changesArray[$change['datCas']][$change['sloupec']] = $change; |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
return $changesArray; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* obtain last change array |
65
|
|
|
* |
66
|
|
|
* @param FlexiBeeRO $object |
67
|
|
|
* @return array Old/New values pairs |
68
|
|
|
*/ |
69
|
|
|
public function getLastChange($object) |
70
|
|
|
{ |
71
|
|
|
$lastChange = null; |
72
|
|
|
$allChanges = $this->getAllChanges($object); |
73
|
|
|
if (count($allChanges)) { |
74
|
|
|
$lastChange = end($allChanges); |
75
|
|
|
} |
76
|
|
|
return $lastChange; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths