Note that there are some explanatory texts on larger screens.

plurals
  1. POSymfony2 DBAL & ORM Setup
    text
    copied!<p>So I have been fiddling around with Symfony2 all morning and read the main documentation or at least half of it. I am stuck at anything related to Database.</p> <p>My simple question is: do we make the database structure before hand or not?</p> <p>Documentation says make the Entity class and then generate the database table using database:create on CLI. I followed and made a blog entity class with orm annotations.</p> <p>ran the command:</p> <pre><code>php app/console doctrine:database:create Warning: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in /Applications/MAMP/htdocs/flairbagSy2/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php on line 36 Could not create database for connection named blog SQLSTATE[HY000] [2002] No such file or directory </code></pre> <p>I think this has something to do with the location of the mysql socket file but I don't know how to change the path of the socket file in Symfony2's configuration.</p> <p>If anyone could just point out where do I change the path of socket file.</p> <p>I once had a similar problem with CakePHP and the simple fix was to add a port key to the db connection array:</p> <pre><code>var $default = array( 'driver' =&gt; 'mysql', 'persistent' =&gt; false, 'host' =&gt; 'localhost', 'login' =&gt; 'root', 'password' =&gt; 'root', 'database' =&gt; 'cake', 'port' =&gt; '/Applications/MAMP/tmp/mysql/mysql.sock', ); </code></pre> <p>How do I do that in Symfony2.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload