Skip to content

Commit bf66ec4

Browse files
committed
[Mailer] Allow register mailer configuration in xml format
1 parent e9ab234 commit bf66ec4

File tree

5 files changed

+35
-1
lines changed

5 files changed

+35
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<xsd:element name="lock" type="lock" minOccurs="0" maxOccurs="1" />
3434
<xsd:element name="messenger" type="messenger" minOccurs="0" maxOccurs="1" />
3535
<xsd:element name="http-client" type="http_client" minOccurs="0" maxOccurs="1" />
36+
<xsd:element name="mailer" type="mailer" minOccurs="0" maxOccurs="1" />
3637
</xsd:choice>
3738

3839
<xsd:attribute name="http-method-override" type="xsd:boolean" />
@@ -552,4 +553,8 @@
552553
<xsd:complexType name="http_header" mixed="true">
553554
<xsd:attribute name="name" type="xsd:string" />
554555
</xsd:complexType>
556+
557+
<xsd:complexType name="mailer">
558+
<xsd:attribute name="dsn" type="xsd:string" />
559+
</xsd:complexType>
555560
</xsd:schema>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'mailer' => [
5+
'dsn' => 'smtp://example.com',
6+
],
7+
]);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:framework="http://symfony.com/schema/dic/symfony"
6+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
7+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
8+
9+
<framework:config>
10+
<framework:mailer dsn="smtp://example.com" />
11+
</framework:config>
12+
</container>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
framework:
2+
mailer:
3+
dsn: 'smtp://example.com'

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
use Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass;
5858
use Symfony\Component\Validator\Mapping\Loader\PropertyInfoLoader;
5959
use Symfony\Component\Validator\Util\LegacyTranslatorProxy;
60-
use Symfony\Component\Validator\Validation;
6160
use Symfony\Component\Workflow;
6261

6362
abstract class FrameworkExtensionTest extends TestCase
@@ -1582,6 +1581,14 @@ public function testHttpClientFullDefaultOptions()
15821581
], $defaultOptions['peer_fingerprint']);
15831582
}
15841583

1584+
public function testMailer(): void
1585+
{
1586+
$container = $this->createContainerFromFile('mailer');
1587+
1588+
$this->assertTrue($container->hasAlias('mailer'));
1589+
$this->assertTrue($container->hasDefinition('mailer.default_transport'));
1590+
}
1591+
15851592
protected function createContainer(array $data = [])
15861593
{
15871594
return new ContainerBuilder(new ParameterBag(array_merge([

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy