Skip to content

Commit 8ab049a

Browse files
committed
move note to doctrine chapter
1 parent 5cc79af commit 8ab049a

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

book/doctrine.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,32 @@ information. By convention, this information is usually configured in an
7878
of your project, like inside your Apache configuration, for example. For
7979
more information, see :doc:`/cookbook/configuration/external_parameters`.
8080

81+
.. sidebar:: Setting Up The Database
82+
83+
One mistake even seasoned developers make when starting a Symfony2 project
84+
is forgetting to setup default charset and collation on their database,
85+
ending up with latin type collations, which are default for most databases.
86+
They might even remember to do it the very first time, but forget that
87+
it's all gone after running a relatively common command during development:
88+
89+
.. code-block:: bash
90+
91+
$ app/console doctrine:database:drop --force
92+
$ app/console doctrine:database:create
93+
94+
There's no way to configure these defaults inside doctrine, as it tries to be
95+
as agnostic as possible in terms of enviroment configuration, so only way around it
96+
is to configure server level defaults.
97+
98+
Setting UTF8 defaults for MySQL is as simple as adding a few lines to configuration file
99+
(typically ``my.cnf``):
100+
101+
.. code-block:: ini
102+
103+
[mysqld]
104+
collation-server = utf8_general_ci
105+
character-set-server = utf8
106+
81107
Now that Doctrine knows about your database, you can have it create the database
82108
for you:
83109

book/installation.rst

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -163,32 +163,6 @@ If there are any issues, correct them now before moving on.
163163
164164
Note that using the ACL is recommended when you have access to them
165165
on your server because changing the umask is not thread-safe.
166-
167-
.. sidebar:: Setting Up The Database
168-
169-
One mistake even seasoned developers make when starting a Symfony2 project
170-
is forgetting to setup default charset and collation on their database,
171-
ending up with latin type collations, which are default for most databases.
172-
They might even remember to do it the very first time, but forget that
173-
it's all gone after running a relatively common command during development:
174-
175-
.. code-block:: bash
176-
177-
$ app/console doctrine:database:drop --force
178-
$ app/console doctrine:database:create
179-
180-
There's no way to configure these defaults inside doctrine, as it tries to be
181-
as agnostic as possible in terms of enviroment configuration, so only way around it
182-
is to configure server level defaults.
183-
184-
Setting UTF8 defaults for MySQL is as simple as adding a few lines to configuration file
185-
(typically ``my.cnf``):
186-
187-
.. code-block:: ini
188-
189-
[mysqld]
190-
collation-server = utf8_general_ci
191-
character-set-server = utf8
192166

193167
When everything is fine, click on "Go to the Welcome page" to request your
194168
first "real" Symfony2 webpage:

0 commit comments

Comments
 (0)