@@ 54-86 (lines=33) @@ | ||
51 | * @param array $configuration |
|
52 | * @return FetchCommandNotificationsCompilerPass $this Fluent interface. |
|
53 | */ |
|
54 | public function processSuccessMailNotification(ContainerBuilder $container, array $configuration) |
|
55 | { |
|
56 | if ($configuration['templates']['success']['enabled']) { |
|
57 | ||
58 | $definition = new Definition(MailNotification::class); |
|
59 | ||
60 | $definition |
|
61 | ->setArguments(array( |
|
62 | new Reference('mailer'), |
|
63 | new Reference('templating'), |
|
64 | array( |
|
65 | 'from' => $configuration['from'], |
|
66 | 'to' => $configuration['to'], |
|
67 | 'cc' => $configuration['cc'], |
|
68 | 'bcc' => $configuration['bcc'], |
|
69 | 'subject' => $configuration['templates']['success']['subject'], |
|
70 | 'template' => $configuration['templates']['success']['template'] |
|
71 | ) |
|
72 | )) |
|
73 | ->setPublic(false) |
|
74 | ; |
|
75 | ||
76 | $container->setDefinition('run_open_code.exchange_rate.notifications.mail.fetch_command.success', $definition); |
|
77 | ||
78 | $container |
|
79 | ->getDefinition('run_open_code.exchange_rate.command.fetch') |
|
80 | ->addMethodCall('addSuccessNotification', array( |
|
81 | new Reference('run_open_code.exchange_rate.notifications.mail.fetch_command.success') |
|
82 | )); |
|
83 | } |
|
84 | ||
85 | return $this; |
|
86 | } |
|
87 | ||
88 | /** |
|
89 | * Process error mail notifications. |
|
@@ 95-127 (lines=33) @@ | ||
92 | * @param array $configuration |
|
93 | * @return FetchCommandNotificationsCompilerPass $this Fluent interface. |
|
94 | */ |
|
95 | public function processErrorMailNotification(ContainerBuilder $container, array $configuration) |
|
96 | { |
|
97 | if ($configuration['templates']['error']['enabled']) { |
|
98 | ||
99 | $definition = new Definition(MailNotification::class); |
|
100 | ||
101 | $definition |
|
102 | ->setArguments(array( |
|
103 | new Reference('mailer'), |
|
104 | new Reference('templating'), |
|
105 | array( |
|
106 | 'from' => $configuration['from'], |
|
107 | 'to' => $configuration['to'], |
|
108 | 'cc' => $configuration['cc'], |
|
109 | 'bcc' => $configuration['bcc'], |
|
110 | 'subject' => $configuration['templates']['error']['subject'], |
|
111 | 'template' => $configuration['templates']['error']['template'] |
|
112 | ) |
|
113 | )) |
|
114 | ->setPublic(false) |
|
115 | ; |
|
116 | ||
117 | $container->setDefinition('run_open_code.exchange_rate.notifications.mail.fetch_command.error', $definition); |
|
118 | ||
119 | $container |
|
120 | ->getDefinition('run_open_code.exchange_rate.command.fetch') |
|
121 | ->addMethodCall('addErrorNotification', array( |
|
122 | new Reference('run_open_code.exchange_rate.notifications.mail.fetch_command.error') |
|
123 | )); |
|
124 | } |
|
125 | ||
126 | return $this; |
|
127 | } |
|
128 | } |
|
129 |