This repository was archived by the owner on Sep 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class QuietFactory implements FactoryInterface
20
20
private $ innerFactory ;
21
21
22
22
/**
23
- * @var LoggerInterface
23
+ * @var LoggerInterface|null
24
24
*/
25
25
private $ logger ;
26
26
@@ -33,7 +33,7 @@ class QuietFactory implements FactoryInterface
33
33
*/
34
34
private $ allowEmptyItems ;
35
35
36
- public function __construct (FactoryInterface $ innerFactory , LoggerInterface $ logger , $ allowEmptyItems = false )
36
+ public function __construct (FactoryInterface $ innerFactory , LoggerInterface $ logger = null , $ allowEmptyItems = false )
37
37
{
38
38
$ this ->innerFactory = $ innerFactory ;
39
39
$ this ->logger = $ logger ;
@@ -48,7 +48,12 @@ public function createItem($name, array $options = array())
48
48
try {
49
49
return $ this ->innerFactory ->createItem ($ name , $ options );
50
50
} catch (RouteNotFoundException $ e ) {
51
- $ this ->logger ->error (sprintf ('%s : %s ' , $ name , $ e ->getMessage ()));
51
+ if (null !== $ this ->logger ) {
52
+ $ this ->logger ->error (
53
+ sprintf ('An exception was thrown while creating a menu item called "%s" ' , $ name ),
54
+ array ('exception ' => $ e )
55
+ );
56
+ }
52
57
53
58
if (!$ this ->allowEmptyItems ) {
54
59
return null ;
Original file line number Diff line number Diff line change 10
10
11
11
<service id =" cmf_menu.factory.quiet" class =" Symfony\Cmf\Bundle\MenuBundle\QuietFactory" public =" false" >
12
12
<argument type =" service" id =" cmf_menu.factory.quiet.inner" />
13
- <argument type =" service" id =" logger" />
13
+ <argument type =" service" id =" logger" on-invalid = " ignore " />
14
14
<argument >%cmf_menu.allow_empty_items%</argument >
15
15
</service >
16
16
You can’t perform that action at this time.
0 commit comments