| Total Complexity | 5 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 92.31% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class FifreeSystemTablesUtils |
||
| 8 | { |
||
| 9 | |||
| 10 | /* @var $em \Doctrine\ORM\EntityManager */ |
||
|
|
|||
| 11 | private $em; |
||
| 12 | private $entities = array(); |
||
| 13 | |||
| 14 | 1 | public function __construct($em) |
|
| 15 | { |
||
| 16 | 1 | $this->em = $em; |
|
| 17 | 1 | $this->entities[\Fi\CoreBundle\Entity\Ruoli::class] = array("priority" => 10); |
|
| 18 | 1 | $this->entities["Fi\CoreBundle\Entity\Operatori"] = array("priority" => 50); |
|
| 19 | 1 | $this->entities["Fi\CoreBundle\Entity\Permessi"] = array("priority" => 100); |
|
| 20 | 1 | $this->entities["Fi\CoreBundle\Entity\Storicomodifiche"] = array("priority" => 110); |
|
| 21 | 1 | $this->entities["Fi\CoreBundle\Entity\Colonnetabelle"] = array("priority" => 120); |
|
| 22 | 1 | $this->entities["Fi\CoreBundle\Entity\Opzionitabelle"] = array("priority" => 150); |
|
| 23 | 1 | $this->entities["Fi\CoreBundle\Entity\Menuapplicazione"] = array("priority" => 160); |
|
| 24 | |||
| 25 | 1 | $this->countEntitiesRows(); |
|
| 26 | 1 | } |
|
| 27 | |||
| 28 | /** |
||
| 29 | * @SuppressWarnings(PHPMD.UnusedLocalVariable) |
||
| 30 | */ |
||
| 31 | 1 | public function countEntitiesRows() |
|
| 32 | { |
||
| 33 | 1 | $records = $this->entities; |
|
| 34 | 1 | foreach ($records as $entity => $detail) { |
|
| 35 | 1 | $qb = $this->em; |
|
| 36 | 1 | $numrows = $qb->createQueryBuilder() |
|
| 37 | 1 | ->select('count(table.id)') |
|
| 38 | 1 | ->from($entity, 'table') |
|
| 39 | 1 | ->getQuery() |
|
| 40 | 1 | ->getSingleScalarResult(); |
|
| 41 | 1 | $this->entities[$entity]["rows"] = $numrows; |
|
| 42 | } |
||
| 43 | 1 | } |
|
| 44 | |||
| 45 | 1 | public function getSystemEntities() |
|
| 46 | { |
||
| 47 | 1 | return $this->entities; |
|
| 48 | } |
||
| 49 | |||
| 50 | public function getDefaultDataSystemEntities() |
||
| 54 | } |
||
| 55 | } |
||
| 56 |