-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Symfony Best Practices typos and errors #4321
Comments
Don't recommend to use parameter classes for third-party bundles. Reported by @stof via Twitter UPDATE: This error has been already fixed |
Listing 5-5: use UPDATE: This error has been already fixed |
Typo page 17: "You may have have noticed". Reported by @aitboudad via Twitter UPDATE: This error has been already fixed |
number the suggestions on the guide |
"that are used as services are good examples of business logic stuff." try to avoid stuff 👶 |
"meant to be shared, then you may define parameters But if you're developing a service for your own" missing period worth perhaps mentioning to avoid this usage as it will be deprecated in next versions, so not really a practice or an option imo |
http://elnur.pro/symfony-without-bundles/ the use of annotations is very contested "Annotations are by far the most convenient and agile way of setting up and looking for mapping" then later you say it is a matter of taste, maybe doing the "if you are advanced" would be more correct. but again not focusing on the practices just typos, i mean to have a uniform phrasing here to be consistent with how it is being done in the previous suggestions |
can be just
and composer will find the latest on its own |
"Pre and Post Hooks" is very short, i know the cookbook details most of it, but it does not elaborate on simple use cases where this can be needed or why one would want those. Maybe just mentioning something like "this is used for example when one wants to ascertain authorization of some kind or something"... |
Reword the reasoning of the recommendation of not using |
It should be |
introduce the word "smoke tests" which i think the "functional tests" referred rather are, i do this in projects but contrary to this i get the routes from the router and eliminate some routes via a blacklist |
UPDATE All the errors reported previously to this comment, are now fixed. They will appear in the new document published in the coming days. Please, keep reporting typos and errors. |
@javiereguiluz on the main page |
What about some short Caching- & Performance-"Best Practices"? |
Generating a bundle without a vendor is not possible in
returns
|
@orthes Thanks for the report - we've got that covered in sensiolabs/SensioGeneratorBundle#290. If you find any other things like this, let us know! |
(Prelude: I really like the document, nice work and great idea!) A small note about the code example of the markdown twig extension. You can skip the method definition in the markdown twig service: class AppExtension extends \Twig_Extension
{
private $parser;
public function __construct(Markdown $parser)
{
$this->parser = $parser;
}
public function getFilters()
{
return array(
new \Twig_SimpleFilter(
'md2html',
array($this, 'markdownToHtml'),
array('is_safe' => array('html'))
),
);
}
public function markdownToHtml($content)
{
return $this->parser->toHtml($content);
}
public function getName()
{
return 'app_extension';
}
} This can be simplified to class AppExtension extends \Twig_Extension
{
private $parser;
public function __construct(Markdown $parser)
{
$this->parser = $parser;
}
public function getFilters()
{
return array(
new \Twig_SimpleFilter(
'md2html',
array($this->parser, 'toHtml'),
array('is_safe' => array('html'))
),
);
}
public function getName()
{
return 'app_extension';
}
} This has the additional benefit, that you don't need to copy all possible arguments and default values from Not sure if this is too confusing, though. |
In Listing 9-9: if ($attribute == self::CREATE && in_array(ROLE_ADMIN, $user->getRoles())) {
return true;
} The EDIT you should also add the third boolean parameter to $ php -r 'var_dump(in_array("ROLE_ADMIN", [0]));'
bool(true) |
section "Using Expressions for Complex Security Restrictions" has a listing with Route annotation and Security annotation, but no ParamConverter. the description says "Notice that this requires the use of the ParamConverter..." => the code example should also have that annotation for completeness. |
@apfelbox thanks for your comments! Regarding your first proposal, it's more concise and convenient, but I have the same concerns as you: "this may be too confusing". Please, let us think over it. Regarding your second proposal, it's a no-brainer and we have just updated the document. It will be published after the next deploy. @dbu let me explain the confusion. The text says that this requires ParamConverter to work ... but it's not necessary to explicitly define a |
ah, you caught me there. i should use the ParamConverter sometimes, |
Typo on Page 13: "available from places wih access" |
@richardmiller notice the remove of inflammatory language http://richardmiller.co.uk/2014/10/14/the-new-symfony-best-practices/ |
The book is now ready to be added to the symfony-docs repo: #4327 Please don't add comments about errors in that Pull Request to make it simpler for the documentation managers to merge it. Once the book is merged, please add any comment that you like. Thank you all for your help spotting errors. |
Where can we add suggestions at this stage ? |
Hey there! Feel free to open a pull request or issue on this repository :). I would love more examples of good translation keys personally. Cheers! |
In a few days we are going to add the "Best Practices" book to the
symfony-docs
repo. That's why it will be great to collect in this issue the typos and errors found by the community. We are not talking (yet) about discussing best practices, but about actual and objective errors.The text was updated successfully, but these errors were encountered: