8000 Merge branch '3.4' into 4.0 · symfony/symfony-docs@8e9dc96 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8e9dc96

Browse files
committed
Merge branch '3.4' into 4.0
* 3.4: Adding yarn install text Reduce ambiguity of encore installation Fixed some typos Fix upgrading to Flex Correction in the console command folder Fixed some typos Add example usage of the link script fixing bad class Rewriting logic for accessing services from the console
2 parents 8109be9 + 2b2739c commit 8e9dc96

File tree

6 files changed

+43
-18
lines changed

6 files changed

+43
-18
lines changed

console.rst

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,33 +161,35 @@ Getting Services from the Service Container
161161
-------------------------------------------
162162

163163
To actually create a new user, the command has to access to some
164-
:doc:`services </service_container>`. This can be done by making the command
165-
extend the :class:`Symfony\\Bundle\\FrameworkBundle\\Command\\ContainerAwareCommand`
166-
instead::
164+
:doc:`services </service_container>`. Since your command is already registered
165+
as a service, you can use normal dependency injection. Imagine you have a
166+
``AppBundle\Service\UserManager`` service that you want to access::
167167

168168
// ...
169-
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
169+
use Symfony\Component\Console\Command\Command;
170+
use AppBundle\Service\UserManager;
170171

171-
class CreateUserCommand extends ContainerAwareCommand
172+
class CreateUserCommand extends Command
172173
{
174+
private $userManager;
175+
176+
public function __construct(UserManager $userManager)
177+
{
178+
$this->userManager = $userManager;
179+
}
180+
173181
// ...
174182

175183
protected function execute(InputInterface $input, OutputInterface $output)
176184
{
177185
// ...
178186

179-
// access the container using getContainer()
180-
$userManager = $this->getContainer()->get('app.user_manager');
181-
$userManager->create($input->getArgument('username'));
187+
$this->userManager->create($input->getArgument('username'));
182188

183189
$output->writeln('User successfully generated!');
184190
}
185191
}
186192

187-
Now, once you have created the required services and logic, the command will execute
188-
the ``create()`` method of the ``app.user_manager`` service and the user will
189-
be created.
190-
191193
Command Lifecycle
192194
-----------------
193195

contributing/code/patches.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,22 @@ Then create a new branch off the ``2.7`` branch to work on the bugfix:
157157
The above checkout commands automatically switch the code to the newly created
158158
branch (check the branch you are working on with ``git branch``).
159159

160+
Use your Branch in an Existing Project
161+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162+
163+
If you want to test your code in an existing project that uses ``symfony/symfony``
164+
or Symfony components, you can use the ``link`` utility provided in the Git repository
165+
you cloned previously.
166+
This tool scans the ``vendor/`` directory of your project, finds Symfony packages it
167+
uses, and replaces them by symbolic links to the ones in the Git repository.
168+
169+
.. code-block:: terminal
170+
171+
$ php link /path/to/your/project
172+
173+
Before running the ``link`` command, be sure that the dependencies of the project you
174+
want to debug are installed by running ``composer install`` inside it.
175+
160176
Work on your Patch
161177
~~~~~~~~~~~~~~~~~~
162178

frontend/encore/installation.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,23 @@ Then, install Encore into your project with Yarn:
1111
1212
.. note::
1313

14-
If you want to use `npm`_ instead of `yarn`_, replace ``yarn add xxx --dev`` by
15-
``npm install xxx --save-dev``.
14+
If you want to use `npm`_ instead of `yarn`_:
15+
16+
.. code-block:: terminal
17+
18+
$ npm install @symfony/webpack-encore --save-dev
1619
1720
.. tip::
1821

19-
If you are using Flex for your project, you can install Encore via:
22+
If you are using Flex for your project, you can initialize your project for Encore via:
2023

2124
.. code-block:: terminal
2225
2326
$ composer require encore
27+
$ yarn install
28+
29+
This will create a ``webpack.config.js`` file, add the ``assets/`` directory, and add ``node_modules/`` to
30+
``.gitignore``.
2431

2532
This command creates (or modifies) a ``package.json`` file and downloads dependencies
2633
into a ``node_modules/`` directory. When using Yarn, a file called ``yarn.lock``

security/voters.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ To recap, here's what's expected from the two abstract methods:
183183
object). Your job is to determine if your voter should vote on the attribute/subject
184184
combination. If you return true, ``voteOnAttribute()`` will be called. Otherwise,
185185
your voter is done: some other voter should process this. In this example, you
186-
return ``true`` if the attribue is ``view`` or ``edit`` and if the object is
186+
return ``true`` if the attribute is ``view`` or ``edit`` and if the object is
187187
a ``Post`` instance.
188188

189189
``voteOnAttribute($attribute, $subject, TokenInterface $token)``

setup/flex.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ manual steps:
169169
new project (don't copy the ``symfony/symfony`` dependency, but add the
170170
relevant components you are effectively using in your project).
171171

172-
#. Install the dependencies in the new project executing ``composer install``.
172+
#. Install the dependencies in the new project executing ``composer update``.
173173
This will make Symfony Flex generate all the configuration files in
174174
``config/packages/``
175175

templating/embedding_controllers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@ string syntax for controllers (i.e. **controllerPath**::**action**):
9898
) ?>
9999
</div>
100100

101-
The result of an embedded controler can also be :doc:`cached </http_cache/esi>`
101+
The result of an embedded controller can also be :doc:`cached </http_cache/esi>`

0 commit comments

Comments
 (0)
0