| Conditions | 3 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 3.0261 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 12 | public function findOpzioniColonnetabella(string $tabella, Operatori $user = null): array |
|
| 18 | { |
||
| 19 | 12 | $em = $this->getEntityManager(); |
|
| 20 | /* @var $qb \Doctrine\ORM\QueryBuilder */ |
||
| 21 | 12 | $qb = $em->createQueryBuilder(); |
|
| 22 | 12 | $qb->select(array('t')); |
|
| 23 | 12 | $qb->from(Colonnetabelle::class, 't'); |
|
| 24 | 12 | $qb->where('t.nometabella = :tabella'); |
|
| 25 | 12 | $qb->andWhere('t.nomecampo is not null'); |
|
| 26 | 12 | $qb->orderBy('t.ordineindex', 'asc'); |
|
| 27 | 12 | $qb->setParameter('tabella', $tabella); |
|
| 28 | 12 | if ($user && !$user->getRuoli()->isSuperadmin()) { |
|
|
|
|||
| 29 | $qb->andWhere('t.operatori_id = :operatore'); |
||
| 30 | $qb->setParameter('operatore', $user->getId()); |
||
| 31 | } |
||
| 32 | //$opzioni = $qb->getQuery()->useQueryCache(true)->useResultCache(true, null, 'Opzionitabella')->getResult(); |
||
| 33 | 12 | $opzioni = $qb->getQuery()->getResult(); |
|
| 34 | |||
| 35 | 12 | return $opzioni; |
|
| 36 | } |
||
| 38 |
If an expression can have both
false, andnullas possible values. It is generally a good practice to always use strict comparison to clearly distinguish between those two values.