Skip to content

small improvements #11416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions components/mime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ images inside the HTML contents::
->embed(fopen('/path/to/images/logo.png', 'r'), 'logo')
->embedFromPath('/path/to/images/signature.gif', 'footer-signature')
// reference images using the syntax 'cid:' + "image embed name"
->html('<img src="cid:logo" /> ... <img src="cid:footer-signature" /> ...')
->html('<img src="cid:logo"/> ... <img src="cid:footer-signature"/> ...')
;

File Attachments
Expand Down Expand Up @@ -251,7 +251,7 @@ email multiparts::

$textContent = new TextPart('Lorem ipsum...');
$htmlContent = new TextPart(sprintf(
'<img src="cid:%s" /> <h1>Lorem ipsum</h1> <p>...</p>', $imageCid
'<img src="cid:%s"/> <h1>Lorem ipsum</h1> <p>...</p>', $imageCid
), 'html');
$bodyContent = new AlternativePart($textContent, $htmlContent);
$body = new RelatedPart($bodyContent, $embeddedImage);
Expand Down Expand Up @@ -390,7 +390,7 @@ the ``TemplatedEmail`` class::
Embedding Images in Emails with Twig
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Instead of dealing with the ``<img src="cid: ..." />`` syntax explained in the
Instead of dealing with the ``<img src="cid: ..."/>`` syntax explained in the
previous sections, when using Twig to render email contents you can refer to
image files as usual. First, define a Twig namespace called ``images`` to
simplify things later::
Expand All @@ -407,7 +407,7 @@ the email contents:
.. code-block:: html+twig

{# '@images/' refers to the Twig namespace defined earlier #}
<img src="{{ email.image('@images/logo.png') }}" />
<img src="{{ email.image('@images/logo.png') }}"/>

<h1>Welcome {{ username }}!</h1>
{# ... #}
Expand Down Expand Up @@ -495,7 +495,7 @@ Now, enable the extension (this is done automatically in Symfony applications)::
Finally, use the ``markdown`` filter to convert parts or the entire email
contents from Markdown to HTML:

.. code-block:: html+twig
.. code-block:: twig

{% filter markdown %}
Welcome {{ username }}!
Expand Down Expand Up @@ -560,7 +560,7 @@ contents from Inky to HTML:

You can combine all filters to create complex email messages:

.. code-block:: html+twig
.. code-block:: twig

{% filter inky|inline_css(source('@zurb/stylesheets/main.css')) %}
{# ... #}
Expand Down
2 changes: 1 addition & 1 deletion components/property_access.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Accessing a non Existing Property Path

By default a :class:`Symfony\\Component\\PropertyAccess\\Exception\\NoSuchPropertyException`
is thrown if the property path passed to :method:`PropertyAccessor::getValue<Symfony\\Component\\PropertyAccess\\PropertyAccessor::getValue>`
does not exist. You can change this behaviour using the
does not exist. You can change this behavior using the
:method:`Symfony\\Component\\PropertyAccess\\PropertyAccessorBuilder::disableExceptionOnInvalidPropertyPath`
method::

Expand Down
2 changes: 1 addition & 1 deletion components/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ routes with UTF-8 characters:
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing
http://symfony.com/schema/routing/routing-1.0.xsd">
https://symfony.com/schema/routing/routing-1.0.xsd">

<route id="route1"
path="/category/{name}"
Expand Down
4 changes: 2 additions & 2 deletions configuration/environment_variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ Symfony provides the following env var processors:
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
https://symfony.com/schema/dic/services/services-1.0.xsd">

<mongodb:config>
<mongodb:client name="default" username="%env(key:user:url:MONGODB_URL)%" password="%env(key:pass:url:MONGODB_URL)%">
Expand Down Expand Up @@ -695,7 +695,7 @@ Symfony provides the following env var processors:
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
https://symfony.com/schema/dic/services/services-1.0.xsd">

<mongodb:config>
<mongodb:client name="default" connectTimeoutMS="%env(int:key:timeout:query_string:MONGODB_URL)%"/>
Expand Down
2 changes: 1 addition & 1 deletion routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ You can also use special attributes to configure them (except ``_fragment``):
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing
http://symfony.com/schema/routing/routing-1.0.xsd">
https://symfony.com/schema/routing/routing-1.0.xsd">

<route id="article_search"
path="/articles/{_locale}/search.{_format}"
Expand Down
88 changes: 45 additions & 43 deletions service_container/configurators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -205,66 +205,68 @@ Services can be configured via invokable configurators (replacing the
``configure()`` method with ``__invoke()``) by omitting the method name, just as
routes can reference :ref:`invokable controllers <controller-service-invoke>`.

.. code-block:: yaml
.. configuration-block::
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the configuration-block was missing


# config/services.yaml
services:
# ...
.. code-block:: yaml

# registers all classes as services, including App\Mail\EmailConfigurator
App\:
resource: '../src/*'
# config/services.yaml
services:
# ...

# override the services to set the configurator
App\Mail\NewsletterManager:
configurator: '@App\Mail\EmailConfigurator'
# registers all classes as services, including App\Mail\EmailConfigurator
App\:
resource: '../src/*'
# ...

App\Mail\GreetingCardManager:
configurator: '@App\Mail\EmailConfigurator'
# override the services to set the configurator
App\Mail\NewsletterManager:
configurator: '@App\Mail\EmailConfigurator'

.. code-block:: xml
App\Mail\GreetingCardManager:
configurator: '@App\Mail\EmailConfigurator'

<!-- config/services.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
.. code-block:: xml

<services>
<prototype namespace="App\" resource="../src/*" />
<!-- config/services.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd">

<service id="App\Mail\NewsletterManager">
<configurator service="App\Mail\EmailConfigurator" />
</service>
<services>
<prototype namespace="App\" resource="../src/*"/>

<service id="App\Mail\GreetingCardManager">
<configurator service="App\Mail\EmailConfigurator" />
</service>
</services>
</container>
<service id="App\Mail\NewsletterManager">
<configurator service="App\Mail\EmailConfigurator"/>
</service>

.. code-block:: php
<service id="App\Mail\GreetingCardManager">
<configurator service="App\Mail\EmailConfigurator"/>
</service>
</services>
</container>

// config/services.php
use App\Mail\GreetingCardManager;
use App\Mail\NewsletterManager;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
.. code-block:: php

// Same as before
$definition = new Definition();
// config/services.php
use App\Mail\GreetingCardManager;
use App\Mail\NewsletterManager;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

$definition->setAutowired(true);
// Same as before
$definition = new Definition();

$this->registerClasses($definition, 'App\\', '../src/*');
$definition->setAutowired(true);

$container->getDefinition(NewsletterManager::class)
->setConfigurator(new Reference(EmailConfigurator::class));
$this->registerClasses($definition, 'App\\', '../src/*');

$container->getDefinition(NewsletterManager::class)
->setConfigurator(new Reference(EmailConfigurator::class));

$container->getDefinition(GreetingCardManager::class)
->setConfigurator(new Reference(EmailConfigurator::class));
$container->getDefinition(GreetingCardManager::class)
->setConfigurator(new Reference(EmailConfigurator::class));

That's it! When requesting the ``App\Mail\NewsletterManager`` or
``App\Mail\GreetingCardManager`` service, the created instance will first be
Expand Down
4 changes: 2 additions & 2 deletions service_container/factories.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,14 @@ method name, just as routes can reference
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
https://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<!-- ... -->

<service id="App\Email\NewsletterManager"
class="App\Email\NewsletterManager">
<factory service="App\Email\NewsletterManagerFactory" />
<factory service="App\Email\NewsletterManagerFactory"/>
</service>
</services>
</container>
Expand Down