Passed
Push — master ( 3519d2...fb2019 )
by Anthony
02:42
created

NavigationRepository::findAllNavigationPage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 10
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Ribs\RibsAdminBundle\Repository;
4
5
use Doctrine\ORM\EntityRepository;
6
7
class NavigationRepository extends EntityRepository
8
{
9
	/**
10
	 * @return array
11
	 * function that return all navigation links of pages and modules
12
	 */
13
	public function findAllNavigation(): array
14
	{
15
		$query = $this->getEntityManager()->getConnection()->prepare("SELECT p.url, p.title, p.title_tag FROM navigation n
16
			INNER JOIN page p ON n.id_page = p.id AND p.displayed = 1
17
			INNER JOIN module m ON n.id_module = m.id AND m.displayed = 1
18
		  	ORDER BY n.order ASC
19
 		");
20
		
21
		$query->execute();
22
		
23
		return $query->fetchAll(\PDO::FETCH_ASSOC);
24
	}
25
	
26
	/**
27
	 * @return array
28
	 * function that return all navigation links of pages
29
	 */
30
	public function findAllNavigationPage(): array
31
	{
32
		$query = $this->getEntityManager()->getConnection()->prepare("SELECT p.url, p.title, p.title_tag FROM navigation n
33
			INNER JOIN page p ON n.id_page = p.id AND p.displayed = 1
34
		  	ORDER BY n.order ASC
35
 		");
36
		
37
		$query->execute();
38
		
39
		return $query->fetchAll(\PDO::FETCH_ASSOC);
40
	}
41
}