-
- Notifications
You must be signed in to change notification settings - Fork 5.3k
[4.0] Setup & Page Creation updates #8544
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice changes! Thanks for this.
page_creation.rst Outdated
resource: ../src/Controller/ | ||
type: annotation | ||
After this one-time setup, you can nowadd your route directly *above* the controller: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nowadd
-> now add
page_creation.rst Outdated
| ||
Second, after this package was downloaded, Flex executed a *recipe*, which automatically | ||
enabled the bundle. Flex recipes exist for many packages (not just bundles) and have | ||
have the ability to do a lot, like adding configuration files, creating directories, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have
is repeated at the end of the previous line.
page_creation.rst Outdated
Finally, template files should live in the ``app/Resources/views`` directory. Create | ||
a new ``app/Resources/views/lucky`` directory with a new ``number.html.twig`` file | ||
inside: | ||
Template files live in the ``templates/`` directory, which was created for your automatically |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for your
-> for you
page_creation.rst Outdated
that is *not* PHP code goes here. | ||
``config/`` | ||
Contains... configuration of course!. You will configure routes, :doc:`services </service_container>` | ||
and pckages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pckages
-> packages
page_creation.rst Outdated
``var/`` | ||
This is where automatically-created files are stored, like cache files | ||
(``var/cache/``), logs (``var/logs/``) and sessions (``var/sessions/``). | ||
(``var/cache/``) and logs (``var/logs/``). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be careful!! var/logs/
is now called var/log/
See symfony/recipes#169
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! I hadn't even realized! Thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need some hand? see #8547 ;)
setup.rst Outdated
cache, logs) to the repository, so you'll have to do the following when | ||
installing an existing Symfony application: | ||
If you're working on an existing Symfony application, you'll just need to do a few | ||
things to get your project setup. Assuming your team uses git, you can setup your |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git
-> Git
page_creation.rst Outdated
| ||
Before diving into this, test it out! If you are using PHP's internal web server | ||
go to: | ||
To map a URL to this controller, create a route in ``config/routes.yaml``: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wonder if this is too advanced to be understood by someone who is starting with Symfony:
To map a URL to this controller, create a route in ``config/routes.yaml``:
Would something like this be better ... or just more verbose and complicated?
Now you need to associate this controller with a public URL so the ``number()`` method is executed when users browse some URL (e.g. ``/lucky/number``). This association is defined creating a **route** in the ``config/routes.yaml`` file:
page_creation.rst Outdated
First, ``annotations`` isn't a real package name: it's an *alias* (i.e. shortcut) | ||
that Flex resolves to ``sensio/framework-extra-bundle``. | ||
| ||
Second, after this package was downloaded, Flex executed a *recipe*, which automatically |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this paragraph I'm missing a simple description of what a recipe is. If you agree, I propose something like: "a set of automated instructions that tell Symfony how to integrate some external package".
Besides, this paragraph is the only one mentioning "bundles" ... and it's strange because we don't introduce that concept anywhere in this article. I propose to remove all references about bundles.
So this is how it'd look:
Second, after this package was downloaded, Flex executed a *recipe*, which is a set of automated instructions that tell Symfony how to integrate some external package. Flex recipes exist for many packages and have the ability to do a lot, like adding configuration files, creating directories, updating ``.gitignore`` and adding new config to your ``.env`` file. Flex *automates* the installation of packages so you can get back to coding.
There is also a ``.env`` file which is loaded. Its contents become environment variables | ||
in the dev environment, making it easier to reference environment variables in your | ||
code. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be covered more #8546. I just bootstrapped this section so that I could link to it.
All comments addressed! |
page_creation.rst Outdated
| ||
Second, after this package was downloaded, Flex executed a *recipe*, which is a | ||
set of automated instructions that tell Symfony how to integrate an external | ||
package. Flex recipes exist for many packages (not just bundles) and have the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last comment on my side. In this paragraph we mention "bundles" for the first time and without prior introduction ("[...] Flex recipes exist for many packages (not just bundles) and have [...]"). Given that bundles are not important in this article, we could remove this mention. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly minor CS things
page_creation.rst Outdated
$ composer require annotations | ||
Then, in ``config/routes.yaml``, remove the route we just created and uncomment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No first person in the docs
page_creation.rst Outdated
.. code-block:: diff | ||
// src/Controller/LuckyController.php | ||
// ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this and the empty line below should be swapped (minor)
you can get back to coding. | ||
| ||
You can learn more about Flex by reading ":doc:`/setup/flex`". But that's not necessary: | ||
Flex works automatically in the background when you add packages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably the time to link to http://symfony.sh ?
page_creation.rst Outdated
You can learn more about Flex by reading ":doc:`/setup/flex`". But that's not necessary: | ||
Flex works automatically in the background when you add packages. | ||
| ||
The bin/console Utility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The console utility?
page_creation.rst Outdated
| ||
.. code-block:: terminal | ||
php bin/console |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commands have to be prefixed by $
(otherwise, the parser won't understand it)
page_creation.rst Outdated
| ||
.. code-block:: terminal | ||
php bin/console debug:router |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
Hi guys!
I'm currently re-reading the most important changes and updating for 4.0 (probably, we need to do a scripted find-replace for the biggest changes (e.g.
AppBundle
->App
,app/config/config.yml
to... other things) for the bulk of the chapters.I'm already continuing with routing and other chapters, but wanted to get this PR at least submitted as soon as possible.