adding table for controller as a service#5033
adding table for controller as a service#5033weaverryan merged 2 commits intosymfony:2.3from dbu:controller-service
Conversation
cookbook/controller/service.rst
Outdated
There was a problem hiding this comment.
ugh. is there a way to better format tables in rst?
There was a problem hiding this comment.
This syntax (which allows multiline too):
+---------+---------+-----+
| Column1 | Column2 | ... |
+=========+=========+=====+
| Value 1 | multi- | ... |
| | line 1 | |
+---------+---------+-----+
| Value 2 | Value 2 | ... |
+---------+---------+-----+
| ... | ... | ... |
+---------+---------+-----+There was a problem hiding this comment.
The simple table syntax allows to wrap long lines in several shorter lines: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#simple-tables
There was a problem hiding this comment.
let's remove this row btw, as getRequest is deprecated
There was a problem hiding this comment.
@wouterj one of these days we should standardize the table syntax to use in the documentation. Hopefully, we'll never recommend to use the rigid grid syntax ;)
|
I like this one :) |
There was a problem hiding this comment.
converted this to a separate tip. i think it does not hurt to mention this here again. the whole doc segment is for people afraid to look at the controller source code.
|
should we mention the table in the introduction of the cookbook article? |
cookbook/controller/service.rst
Outdated
There was a problem hiding this comment.
this is wrong. You are missing the ->getForm() call in the equivalent code
There was a problem hiding this comment.
cookbook/controller/service.rst
Outdated
There was a problem hiding this comment.
this renders quite badly (all code lines floating) but i found no way how to include multiline source code in a table cell... ideas? btw, the indention is missing on purpose as otherwise we get a compile error.
There was a problem hiding this comment.
Tables are a hell in Sphinx to get things like this working nicely. I don't know of a nice solution other than not using table...
There was a problem hiding this comment.
I would suggest to use a definition list instead:
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::createForm` (service: ``form.factory``)
.. code-block:: php
$formFactory->create($type, $data, $options);and so on
|
thanks @xabbuh , switched to definition list. the rendering looks ok to me. |
|
awesome PR 👍 |
cookbook/controller/service.rst
Outdated
There was a problem hiding this comment.
This is not exactly the same. The Controller class doesn't throw the exception.
There was a problem hiding this comment.
oh, indeed. what a weird method anyways. will fix
|
fixed the comments. and thanks @timglabisch! credit goes to @sixty-nine, he started this ages ago and i said i would do a PR with it, but never got around to do it until now. |
cookbook/controller/service.rst
Outdated
There was a problem hiding this comment.
Typo : maybe change to renderView :)
|
thanks @Pierstoval , updated the things you noted. |
|
Thanks @dbu! This looks really good to me. |
This PR was merged into the 2.3 branch. Discussion ---------- adding table for controller as a service | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | all | Fixed tickets | - an old thing from my todo list. talked with @beberlei about this at some point. he had a couple of interesting blog posts about this topic but i can't find it anymore. and afaik the symfony doc does not want this kind of external links anyways. Commits ------- b17f422 use definition list instead of table 8e82db4 adding table for controller as a service
When I merge to 2.6, I'll properly change the service ids and variable names
an old thing from my todo list. talked with @beberlei about this at some point. he had a couple of interesting blog posts about this topic but i can't find it anymore. and afaik the symfony doc does not want this kind of external links anyways.