Skip to content

Misc changes #4695

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

Closed
wants to merge 2 commits into from
Closed
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
10 changes: 7 additions & 3 deletions best_practices/controllers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ for the homepage of our app:
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$posts = $em->getRepository('App:Post')->findLatest();
$posts = $this->getDoctrine()
->getRepository('AppBundle:Post')
->findLatest();

return $this->render('default/index.html.twig', array(
'posts' => $posts
Expand All @@ -136,6 +137,7 @@ For example:

.. code-block:: php

use AppBundle\Entity\Post;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

/**
Expand All @@ -146,7 +148,7 @@ For example:
$deleteForm = $this->createDeleteForm($post);

return $this->render('admin/post/show.html.twig', array(
'post' => $post,
'post' => $post,
Copy link
Member

Choose a reason for hiding this comment

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

I'm 👎 here. The code team decided recently to not align array values. I would just trim the spaces to one single space.

Copy link
Member

Choose a reason for hiding this comment

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

It'll significantly improves readability, which is way more important in the docs than having nice diffs in PRs.

This change gets a very big 👍 from me.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, let's keep it. Readability is a good argument. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the code I'm personally not a big fan of alligning myself as most of the time it gives more problems than it solves.

For documentation, I think it's a really good idea to improve readability as you want to make docs as easy to digest as possible (I'm currently rereading parts of PHP documentation, and .... it's not great, but as someone with experience I can slip past those problems, but for newcomers it might be a mine field).

'delete_form' => $deleteForm->createView(),
));
}
Expand Down Expand Up @@ -188,8 +190,10 @@ flexible:

.. code-block:: php

use AppBundle\Entity\Post;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\HttpFoundation\Request;

/**
* @Route("/comment/{postSlug}/new", name = "comment_new")
Expand Down