-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[3.0][Cookbook] Use the 3.0 directory structure #5917
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
Changes from 8 commits
bea4a0c
b6d93f0
b3da3b7
6614c0f
af7052b
ef613f6
df20095
f2be12a
47e11f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,12 +12,16 @@ directory structure is: | |
|
||
your-project/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added |
||
├─ app/ | ||
│ ├─ cache/ | ||
│ ├─ config/ | ||
│ ├─ logs/ | ||
│ └─ ... | ||
├─ src/ | ||
│ └─ ... | ||
├─ tests/ | ||
│ └─ ... | ||
├─ var/ | ||
│ ├─ cache/ | ||
│ ├─ logs/ | ||
│ └─ ... | ||
├─ vendor/ | ||
│ └─ ... | ||
└─ web/ | ||
|
@@ -41,13 +45,13 @@ in the ``AppKernel`` class of you application:: | |
|
||
public function getCacheDir() | ||
{ | ||
return $this->rootDir.'/'.$this->environment.'/cache'; | ||
return dirname(__DIR__).'/var/'.$this->environment.'/cache'; | ||
} | ||
} | ||
|
||
``$this->rootDir`` is the absolute path to the ``app`` directory and ``$this->environment`` | ||
is the current environment (i.e. ``dev``). In this case you have changed | ||
the location of the cache directory to ``app/{environment}/cache``. | ||
In this code, ``$this->environment`` is the current environment (i.e. ``dev``). | ||
In this case you have changed the location of the cache directory to | ||
``var/{environment}/cache``. | ||
|
||
.. caution:: | ||
|
||
|
@@ -74,35 +78,34 @@ method:: | |
|
||
public function getLogDir() | ||
{ | ||
return $this->rootDir.'/'.$this->environment.'/logs'; | ||
return dirname(__DIR__).'/var/'.$this->environment.'/logs'; | ||
} | ||
} | ||
|
||
Here you have changed the location of the directory to ``app/{environment}/logs``. | ||
Here you have changed the location of the directory to ``var/{environment}/logs``. | ||
|
||
.. _override-web-dir: | ||
|
||
Override the ``web`` Directory | ||
------------------------------ | ||
|
||
If you need to rename or move your ``web`` directory, the only thing you | ||
need to guarantee is that the path to the ``app`` directory is still correct | ||
need to guarantee is that the path to the ``var`` directory is still correct | ||
in your ``app.php`` and ``app_dev.php`` front controllers. If you simply | ||
renamed the directory, you're fine. But if you moved it in some way, you | ||
may need to modify these paths inside those files:: | ||
|
||
require_once __DIR__.'/../Symfony/app/bootstrap.php.cache'; | ||
require_once __DIR__.'/../Symfony/app/AppKernel.php'; | ||
require_once __DIR__.'/../path/to/var/bootstrap.php.cache'; | ||
|
||
You also need to change the ``extra.symfony-web-dir`` option in the ``composer.json`` | ||
file: | ||
You also need to change the ``extra.symfony-web-dir`` option in the | ||
``composer.json`` file: | ||
|
||
.. code-block:: javascript | ||
.. code-block:: json | ||
|
||
{ | ||
... | ||
"...": "...", | ||
"extra": { | ||
... | ||
"...": "...", | ||
"symfony-web-dir": "my_new_web_dir" | ||
} | ||
} | ||
|
@@ -154,8 +157,8 @@ file: | |
|
||
.. code-block:: bash | ||
|
||
$ php app/console cache:clear --env=prod | ||
$ php app/console assetic:dump --env=prod --no-debug | ||
$ php bin/console cache:clear --env=prod | ||
$ php bin/console assetic:dump --env=prod --no-debug | ||
|
||
Override the ``vendor`` Directory | ||
--------------------------------- | ||
|
@@ -179,6 +182,7 @@ The change in the ``composer.json`` will look like this: | |
Then, update the path to the ``autoload.php`` file in ``app/autoload.php``:: | ||
|
||
// app/autoload.php | ||
|
||
// ... | ||
$loader = require '/some/dir/vendor/autoload.php'; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -260,12 +260,12 @@ directory with at least the following contents: | |
.. code-block:: text | ||
|
||
/app/bootstrap.php.cache | ||
/app/cache/* | ||
/var/cache/* | ||
/app/config/parameters.yml | ||
/app/logs/* | ||
!app/cache/.gitkeep | ||
!app/logs/.gitkeep | ||
/app/SymfonyRequirements.php | ||
/var/logs/* | ||
!var/cache/.gitkeep | ||
!var/logs/.gitkeep | ||
/bin/SymfonyRequirements.php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. - /bin/SymfonyRequirements.php
+ /var/SymfonyRequirements.php ? |
||
/build/ | ||
/vendor/ | ||
/bin/ | ||
|
@@ -388,7 +388,7 @@ MySQL database. | |
|
||
.. code-block:: bash | ||
|
||
$ php app/console doctrine:schema:update --force | ||
$ php bin/console doctrine:schema:update --force | ||
|
||
This command builds the tables and indexes for your MySQL database. If your | ||
Symfony application is more complex than a basic Symfony Standard Edition, you | ||
|
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.
Why isn't the
bin
directory present in here ? Is it expected ?It has nothing to do with configuration files, but same as for new
var
andtests
directories, right ?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 read through it: it's focusing on just the stuff in the
app/
directory. I think really we never neededsrc
,vendor
orweb
here.