Skip to content
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

Update book to comply with best practices, round 3 #4779

Merged
merged 5 commits into from
Mar 13, 2015

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Jan 6, 2015

Q A
Doc fix? yes
New docs? yes
Applies to all
Fixed tickets #4431

@@ -51,6 +51,10 @@ Another advantage is that centralizing your templates simplifies the work
of your designers. They don't need to look for templates in lots of directories
scattered through lots of bundles.

.. best-practice::

Use lowercased snake_case for directory and template names.
Copy link
Member Author

Choose a reason for hiding this comment

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

I believe this was the guideline, but it was never written somewhere. As lots of people are struggling with it, I think it's a good idea to document it. While doing this, I've also snake_cased all template paths in the currently updated book articles.

Copy link
Member

Choose a reason for hiding this comment

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

@javiereguiluz What do you think? We've never talked too much about this directly. The negative to underscoring everything is that templates aren't the same as their controllers anymore - PostAdminController::createPostAction would be in post_admin/create_post.html.twig.

We're just talking about a recommendation here - not life or death - but let's think about it. The old upper-camel case was done without really thinking, to support the @Template magic (because we were all very used to having this from 1.x). If we break from this, then @Template won't work, and even if we update it, trying to transform from createPostAction to create_post.html.twig could be buggy.

What do guys think?

Copy link
Member

Choose a reason for hiding this comment

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

In this moment, my thinking is that the old way seems the best, as it's very simple: everything just matches: no transformations (of course, you can do whatever you want).

Copy link
Member

Choose a reason for hiding this comment

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

ping @javiereguiluz I need your input on upper/lower case template directories here - this will affect a lot of different parts. Thanks :)

Copy link
Member

Choose a reason for hiding this comment

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

ping again @javiereguiluz!

Copy link
Member Author

Choose a reason for hiding this comment

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

moved these changes to #5001

@wouterj
Copy link
Member Author

wouterj commented Jan 6, 2015

While changing the Testing and HttpCache articles, I got a bit distracted fixing other things :) I'll do a follow up PR of a Testing article rewrite, as it isn't really nicely written (and it's the oldest not actively maintained document).

@stof
Copy link
Member

stof commented Jan 6, 2015

This will conflict with #4740

@wouterj
Copy link
Member Author

wouterj commented Jan 6, 2015

I don't think so, as Javier updated the cookbook and I the book

@stof
Copy link
Member

stof commented Jan 6, 2015

ah, I forgot the fact that his PR does not do the search and replace on the whole doc.

👍

$metadata->addPropertyConstraint(
'city',
Length(array("min" => 3)));
$metadata->addPropertyConstraint('city', Assert\Length(array(
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not correct, see #4789 (including some other fixes)

Copy link
Member

Choose a reason for hiding this comment

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

What's the issue? Just that we should have the line breaks different?

Copy link
Member Author

Choose a reason for hiding this comment

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

missing new

@wouterj wouterj mentioned this pull request Jan 11, 2015
$response->isNotModified($request);
public function homepageAction(Request $request)
{
$response = $this->render('homepage.html.twig');
Copy link
Member

Choose a reason for hiding this comment

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

This should be something like default/homepage.html.twig

// the ETag or the Last-Modified value
// (based on the Request, data is retrieved from
// a database or a key-value store for instance)
$article = ...;
Copy link
Contributor

Choose a reason for hiding this comment

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

i would prefer valid php here.

Copy link
Member Author

Choose a reason for hiding this comment

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

this is our standard

@wouterj
Copy link
Member Author

wouterj commented Mar 10, 2015

Updated. Thansk for the reviews!

@weaverryan weaverryan merged commit 3ab53a6 into symfony:2.3 Mar 13, 2015
weaverryan added a commit that referenced this pull request Mar 13, 2015
…terJ)

This PR was merged into the 2.3 branch.

Discussion
----------

Update book to comply with best practices, round 3

| Q   | A
| --- | ---
| Doc fix? | yes
| New docs? | yes
| Applies to | all
| Fixed tickets | #4431

Commits
-------

3ab53a6 Fixed some of the comments
c6ff013 Made http cache chapter best-practices-compatible and lots of other fixes
4840768 Made propel chapter best-practices-compatible and lots of other fixes
a272f99 Made testing chapter best-practices-compatible and lots of other fixes
c49f75d Made validation chapter best-practices-compatible
$link = $crawler
->filter('a:contains("Greet")') // find all links with the text "Greet"
->eq(1) // select the second link in the list
->link() // and click it
Copy link
Member

Choose a reason for hiding this comment

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

very nice

weaverryan added a commit that referenced this pull request Mar 13, 2015
@weaverryan
Copy link
Member

@wouterj I reviewed this carefully and there is SO much good stuff here. Nice work! I had only very minor changes at sha: 24f773c - especially considering the size of this PR.

Thanks!

weaverryan added a commit that referenced this pull request Mar 13, 2015
* 2.3: (23 commits)
  Update configuration.rst
  Update configuration.rst
  Readability
  [#4875] Minor language tweaks
  [#4779] Minor tweaks to a huge PR
  Fixed some of the comments
  [#4793] Very minor tweak that sounds more natural
  [config][translator] use the new fallbacks option.
  Linked "logrotate" to its official website
  Minor rewording
  Added a note about log file sizes and the use of logrotate
  Use snake_case for template names
  Made http cache chapter best-practices-compatible and lots of other fixes
  Made propel chapter best-practices-compatible and lots of other fixes
  Made testing chapter best-practices-compatible and lots of other fixes
  Made validation chapter best-practices-compatible
  Remove usage of first person
  Updated as per feedback.
  Updated as per feedback
  Fix typos
  ...

Conflicts:
	book/forms.rst
	book/testing.rst
	cookbook/logging/monolog.rst
	reference/configuration/framework.rst
weaverryan added a commit that referenced this pull request Mar 13, 2015
* 2.6: (32 commits)
  Update configuration.rst
  Update configuration.rst
  Readability
  [#4875] Minor language tweaks
  [#4779] Minor tweaks to a huge PR
  [#4724] Minor language tweaks and cross-link to form theming
  document the validation payload option
  Fixed some of the comments
  [#4793] Very minor tweak that sounds more natural
  [#4732] Tweaking language, clarifying purpose of disabling form and that you can disable CSRF on 1 form
  [#4732] Tweaking language, clarifying purpose of disabling form and that you can disable CSRF on 1 form
  [config][translator] use the new fallbacks option.
  add missing reference options and descriptions
  Linked "logrotate" to its official website
  Minor rewording
  Added a note about log file sizes and the use of logrotate
  Use snake_case for template names
  Fixed minor grammar issues
  Made http cache chapter best-practices-compatible and lots of other fixes
  Made propel chapter best-practices-compatible and lots of other fixes
  ...
weaverryan added a commit that referenced this pull request Mar 13, 2015
* 2.7: (38 commits)
  Update configuration.rst
  Update configuration.rst
  Readability
  [#4875] Minor language tweaks
  [#4779] Minor tweaks to a huge PR
  [#4724] Minor language tweaks and cross-link to form theming
  [Serializer] Fix CS
  document the validation payload option
  Fixed some of the comments
  [#4793] Very minor tweak that sounds more natural
  [#4732] Tweaking language, clarifying purpose of disabling form and that you can disable CSRF on 1 form
  [#4732] Tweaking language, clarifying purpose of disabling form and that you can disable CSRF on 1 form
  [config][translator] use the new fallbacks option.
  add missing reference options and descriptions
  Linked "logrotate" to its official website
  Minor rewording
  Added a note about log file sizes and the use of logrotate
  Use snake_case for template names
  Fixed minor grammar issues
  Made http cache chapter best-practices-compatible and lots of other fixes
  ...
@wouterj wouterj deleted the best_practices_3 branch March 17, 2015 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants