1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Application\Bundle\DefaultBundle\Service; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Persistence\ObjectRepository; |
6
|
|
|
use Sonata\BlockBundle\Block\BlockContextInterface; |
7
|
|
|
use Sonata\BlockBundle\Block\Service\AbstractBlockService; |
8
|
|
|
use Stfalcon\Bundle\EventBundle\Repository\PageRepository; |
9
|
|
|
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; |
10
|
|
|
use Symfony\Component\HttpFoundation\Response; |
11
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class FooterBlockService. |
15
|
|
|
*/ |
16
|
|
|
class FooterBlockService extends AbstractBlockService |
17
|
|
|
{ |
18
|
|
|
/** @var PageRepository */ |
19
|
|
|
private $pageRepository; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* ProgramEventBlockService constructor. |
23
|
|
|
* |
24
|
|
|
* @param string $name |
25
|
|
|
* @param EngineInterface $templating |
26
|
|
|
* @param ObjectRepository $pageRepository |
27
|
|
|
*/ |
28
|
|
|
public function __construct($name, EngineInterface $templating, ObjectRepository $pageRepository) |
29
|
|
|
{ |
30
|
|
|
parent::__construct($name, $templating); |
31
|
|
|
|
32
|
|
|
$this->pageRepository = $pageRepository; |
|
|
|
|
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* {@inheritdoc} |
37
|
|
|
*/ |
38
|
|
|
public function execute(BlockContextInterface $blockContext, Response $response = null) |
39
|
|
|
{ |
40
|
|
|
$pages = $this->pageRepository->findBy(['showInFooter' => true]); |
41
|
|
|
|
42
|
|
|
return $this->renderResponse($blockContext->getTemplate(), [ |
43
|
|
|
'block' => $blockContext->getBlock(), |
44
|
|
|
'pages' => $pages, |
45
|
|
|
], $response); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* {@inheritdoc} |
50
|
|
|
*/ |
51
|
|
|
public function configureSettings(OptionsResolver $resolver) |
52
|
|
|
{ |
53
|
|
|
$resolver->setDefaults([ |
54
|
|
|
'template' => 'ApplicationDefaultBundle:Redesign:_footer_pages.html.twig', |
55
|
|
|
'pages' => null, |
56
|
|
|
]); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.