Skip to content

[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

Closed
wants to merge 6 commits into from
Closed

[4.0] Setup & Page Creation updates #8544

wants to merge 6 commits into from

Conversation

weaverryan
Copy link
Member

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.

Copy link
Member

@javiereguiluz javiereguiluz left a 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.

resource: ../src/Controller/
type: annotation

After this one-time setup, you can nowadd your route directly *above* the controller:
Copy link
Member

Choose a reason for hiding this comment

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

nowadd -> now add


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,
Copy link
Member

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.

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
Copy link
Member

Choose a reason for hiding this comment

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

for your -> for you

that is *not* PHP code goes here.
``config/``
Contains... configuration of course!. You will configure routes, :doc:`services </service_container>`
and pckages.
Copy link
Member

Choose a reason for hiding this comment

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

pckages -> packages

``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/``).
Copy link
Member

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

Copy link
Member Author

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 :)

Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

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

git -> Git

@@ -65,44 +60,154 @@ random) number and prints it. To do that, create a "Controller class" and a
}
}

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``:
Copy link
Member

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:

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
Copy link
Member

@javiereguiluz javiereguiluz Oct 24, 2017

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.

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 will be covered more #8546. I just bootstrapped this section so that I could link to it.

@weaverryan weaverryan added this to the 3.4 milestone Oct 24, 2017
@weaverryan
Copy link
Member Author

All comments addressed!


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
Copy link
Member

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!

Copy link
Member

@wouterj wouterj left a 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


$ composer require annotations

Then, in ``config/routes.yaml``, remove the route we just created and uncomment
Copy link
Member

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

.. code-block:: diff

// src/Controller/LuckyController.php
// ...
Copy link
Member

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.
Copy link
Member

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 ?

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
Copy link
Member

Choose a reason for hiding this comment

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

The console utility?


.. code-block:: terminal

php bin/console
Copy link
Member

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)


.. code-block:: terminal

php bin/console debug:router
Copy link
Member

Choose a reason for hiding this comment

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

same here

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.

5 participants