|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Cdf\BiCoreBundle\Utils\Tabella; |
|
4
|
|
|
|
|
5
|
|
|
use Cdf\BiCoreBundle\Entity\Opzionitabelle; |
|
6
|
|
|
use Cdf\BiCoreBundle\Entity\Colonnetabelle; |
|
7
|
|
|
|
|
8
|
|
|
trait TabellaOpzioniFromCoreTrait |
|
9
|
|
|
{ |
|
10
|
12 |
|
protected function getOpzionitabellaFromCore() |
|
11
|
|
|
{ |
|
12
|
12 |
|
$repoopzionitabelle = $this->em->getRepository(Opzionitabelle::class); |
|
13
|
12 |
|
$repocolonnetabelle = $this->em->getRepository(Colonnetabelle::class); |
|
14
|
12 |
|
$opzionitabella = $repoopzionitabelle->findOpzioniTabella($this->tablename); |
|
|
|
|
|
|
15
|
12 |
|
$colonnetabella = $repocolonnetabelle->findOpzioniColonnetabella($this->tablename, $this->user); |
|
|
|
|
|
|
16
|
|
|
|
|
17
|
12 |
|
return array('opzionitabella' => $opzionitabella, 'colonnetabella' => $colonnetabella); |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
12 |
|
protected function setOpzioniTabellaFromCore($colonnadatabase, &$opzionibuilder) |
|
21
|
|
|
{ |
|
22
|
12 |
|
$colonnetabellacore = $this->opzionitabellacore['colonnetabella']; |
|
23
|
|
|
//$nomecolonna = $this->tablename . "." . $colonnadatabase["fieldName"]; |
|
|
|
|
|
|
24
|
|
|
/* @var $colonnatabellacore \Cdf\BiCoreBundle\Entity\Colonnetabelle */ |
|
25
|
12 |
|
foreach ($colonnetabellacore as $colonnatabellacore) { |
|
26
|
3 |
|
$campodabonificare = $colonnatabellacore->getNometabella().'.'.$colonnatabellacore->getNomecampo(); |
|
27
|
3 |
|
$campo = $this->bonificaNomeCampo($campodabonificare); |
|
|
|
|
|
|
28
|
3 |
|
$this->buildOpzioneTabellaFromCore($campo, 'etichetta', 'getEtichettaindex', $colonnatabellacore, $opzionibuilder); |
|
29
|
3 |
|
$this->buildOpzioneTabellaFromCore($campo, 'larghezza', 'getLarghezzaindex', $colonnatabellacore, $opzionibuilder); |
|
30
|
3 |
|
$this->buildOpzioneTabellaFromCore($campo, 'escluso', 'getMostraindex', $colonnatabellacore, $opzionibuilder); |
|
31
|
3 |
|
$this->buildOpzioneTabellaFromCore($campo, 'editabile', 'getEditabile', $colonnatabellacore, $opzionibuilder); |
|
32
|
3 |
|
$this->buildOpzioneTabellaFromCore($campo, 'ordine', 'getOrdineindex', $colonnatabellacore, $opzionibuilder); |
|
33
|
3 |
|
$opzionibuilder[$campo]['campoextra'] = false; |
|
34
|
|
|
} |
|
35
|
12 |
|
} |
|
36
|
|
|
|
|
37
|
3 |
|
protected function buildOpzioneTabellaFromCore($campo, $modellocolonneindex, $entityproperty, $colonnatabellacore, &$opzionibuilder) |
|
38
|
|
|
{ |
|
39
|
3 |
|
if (null !== ($colonnatabellacore->$entityproperty())) { |
|
40
|
3 |
|
$opzionibuilder[$campo][$modellocolonneindex] = $colonnatabellacore->$entityproperty(); |
|
41
|
|
|
} |
|
42
|
3 |
|
} |
|
43
|
|
|
} |
|
44
|
|
|
|
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.