NavigationRepository::findAllNavigation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 11
rs 10
1
<?php
2
3
namespace PiouPiou\RibsAdminBundle\Repository;
4
5
use Doctrine\DBAL\DBALException;
6
use Doctrine\ORM\EntityRepository;
7
8
class NavigationRepository extends EntityRepository
9
{
10
    /**
11
     * function that return all navigation links of pages and modules
12
     * @return array
13
     * @throws DBALException
14
     */
15
    public function findAllNavigation(): array
16
    {
17
        $query = $this->getEntityManager()->getConnection()->prepare("SELECT p.url, p.title, p.title_tag FROM navigation n
18
			LEFT JOIN page p ON n.id_page = p.id AND p.displayed = 1
19
			LEFT JOIN module m ON n.id_module = m.id AND m.displayed = 1
20
		  	ORDER BY n.order ASC
21
 		");
22
23
        $query->execute();
24
25
        return $query->fetchAll(\PDO::FETCH_ASSOC);
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\DBAL\Statement::fetchAll() has been deprecated: Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

25
        return /** @scrutinizer ignore-deprecated */ $query->fetchAll(\PDO::FETCH_ASSOC);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
26
    }
27
28
    /**
29
     * function that return all navigation links of pages
30
     * @return array
31
     * @throws DBALException
32
     */
33
    public function findAllNavigationPage(): array
34
    {
35
        $query = $this->getEntityManager()->getConnection()->prepare("SELECT p.id, p.url, p.title, p.title_tag FROM navigation n
36
			INNER JOIN page p ON n.id_page = p.id AND p.displayed = 1
37
		  	ORDER BY n.order ASC
38
 		");
39
40
        $query->execute();
41
42
        return $query->fetchAll(\PDO::FETCH_ASSOC);
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\DBAL\Statement::fetchAll() has been deprecated: Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

42
        return /** @scrutinizer ignore-deprecated */ $query->fetchAll(\PDO::FETCH_ASSOC);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
43
    }
44
}
45