Skip to content

Conversation

matthieu88160
Copy link
Contributor

This update offer a decorator code sample for the 'app.mailer' service. This allow to the newcomers to fully understand the decorator principle.

This update offer a decorator code sample for the 'app.mailer' service. This allow to the newcomers to fully understand the decorator principle.
Copy link
Contributor

@HeahDude HeahDude left a comment

Choose a reason for hiding this comment

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

Thanks for opening that PR. I kind of like this change, I'm just not sure yet if we should be that explicit here.

Suppose you want to process the text parts to send behind the ``app.mailer``, you will create a mailer decorator::

// AppBundle/DecoratingMailer.php
namespace AppBundle\DecoratingMailer;
Copy link
Contributor

Choose a reason for hiding this comment

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

To be consistent, the namespace should be only AppBundle.

Copy link
Contributor Author

@matthieu88160 matthieu88160 Mar 7, 2017

Choose a reason for hiding this comment

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

Oh, I've done a mistake. What about using :

  • AppBundle\Decorator as namespace
  • AppBundle/Decorator/DecoratingMailer.php as file
Copy link
Contributor

@HeahDude HeahDude Mar 7, 2017

Choose a reason for hiding this comment

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

If we were to add a namespace I think we should use Mailer. But then other examples would need an update too.
What do others think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We must provide the better practice to follow in the documentation examples and I think adding a namespace is a good practice in this context case. I'll update to AppBundle\Mailer tomorrow.

…Bundle\\Mailer namespace and be consistent with semantical bundle structure
@matthieu88160
Copy link
Contributor Author

Update done for Mailer service/class namespace in service_container and DependencyInjection component

@javiereguiluz
Copy link
Member

@matthieu88160 I'm sorry we didn't take care of your proposal on time. During the past months, the Symfony Docs team has decided to aggressively simplify everything because we don't have enough resources to maintain everything. In the past weeks we've deleted thousands of lines, even entire articles.

About your specific changes, changing use AppBundle\Mailer; to use AppBundle\Mailer\Mailer; is not that important in the services articles (and some readers could think that the double Mailer is some kind of error).

About the other proposal, I don't think it's necessary to display an example of the source code of the DecoratingMailer. The reason is that this service is not different to any other service explained in the other docs, so this would be a content duplication. The service_decoration.rst article should focus only on explaining what is different (the decorates option, etc.)

That's why I'm closing this as "won't fix" and I hope you understand why. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment