title: Doctrine returns always the same record & schema:update fails
body: <p>I am trying to use an existing database with Symfony/Doctrine and nothing seems to work.</p>
  
  <p>The import (database to mapping) was successful and the generated files in src/xxx/Entity look good.</p>
  
  <p>However, there are two problems:</p>
  
  <p><strong>The problem</strong>:</p>
  
  <p>Doctrine wants to run 13 queries on my ridiculously small database. I thought that after the import, Doctrine would sync with the online database. Yet, this wasn't the case at all.</p>
  
  <p>It would be better if I didn't modify the database (because of reasons) and in any case the <code>doctrine:schema:update</code> fails completely:</p>
  
  <pre><code>### doctrine:schema:update --dump-sql
  ALTER TABLE categorie CHANGE id id TINYINT(1) NOT NULL;
  ALTER TABLE produit CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE categorie_id categorie_id TINYINT(1) DEFAULT NULL, CHANGE derniere_maj derniere_maj DATETIME NOT NULL;
  DROP INDEX fk_produit_categorie1_idx ON produit;
  CREATE INDEX IDX_29A5EC27BCF5E72D ON produit (categorie_id);
  ALTER TABLE commande_client CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE client_id client_id INT DEFAULT NULL, CHANGE date_creation date_creation DATETIME NOT NULL, CHANGE no_confirmation no_confirmation INT NOT NULL;
  DROP INDEX fk_commande_client_client1_idx ON commande_client;
  CREATE INDEX IDX_C510FF8019EB6921 ON commande_client (client_id);
  ALTER TABLE commande_client_vers_produit DROP quantite, CHANGE commande_client_id commande_client_id INT NOT NULL, CHANGE produit_id produit_id INT NOT NULL;
  DROP INDEX fk_commande_client_has_produit_commande_client1_idx ON commande_client_vers_produit;
  CREATE INDEX IDX_6E3497729E73363 ON commande_client_vers_produit (commande_client_id);
  DROP INDEX fk_commande_client_has_produit_produit1_idx ON commande_client_vers_produit;
  CREATE INDEX IDX_6E349772F347EFB ON commande_client_vers_produit (produit_id);
  ALTER TABLE client CHANGE id id INT AUTO_INCREMENT NOT NULL;
  
  ### doctrine:schema:update --force
  
    [Doctrine\DBAL\Exception\DriverException]                                                                               
    An exception occurred while executing 'ALTER TABLE categorie CHANGE id id TINYINT(1) NOT NULL':                         
    SQLSTATE[HY000]: General error: 1025 Error on rename of './chezbio/#sql-1983_d2' to './chezbio/categorie' (errno: 150)  
  
    [Doctrine\DBAL\Driver\PDOException]                                                                                     
    SQLSTATE[HY000]: General error: 1025 Error on rename of './chezbio/#sql-1983_d2' to './chezbio/categorie' (errno: 150)  
  
    [PDOException]                                                                                                          
    SQLSTATE[HY000]: General error: 1025 Error on rename of './chezbio/#sql-1983_d2' to './chezbio/categorie' (errno: 150)  
  </code></pre>
  
  <p>Why all these updates? The actual database is theoretically correctly designed.</p>
  
  <p>The most important part of the problem:</p>
  
  <p>(This could be related with the part where Doctrine wasn't able to sync with the online database.)</p>
  
  <p>I'm trying to <code>select</code> a couple rows from my table.</p>
  
  <p>For example, here I try to get all the rows from the <code>categorie</code> table:</p>
  
  <pre><code>$em-&gt;getRepository('AlembicBioBundle:Categorie')-&gt;findAll();
  </code></pre>
  
  <p>I have 4 rows in this table:</p>
  
  <pre><code>mysql&gt; SELECT * FROM categorie;
  +----+----------+
  | id | nom      |
  +----+----------+
  |  1 | FROMAGES |
  |  2 | PAINS    |
  |  3 | LEGUMES  |
  |  4 | VIANDES  |
  +----+----------+
  </code></pre>
  
  <p>When I use the Doctrine function (and not the manual query) I get 4 occurrences of the row "FROMAGES". <em>What could be causing this problem?</em></p>
  
  <p>The worst part is when I do:</p>
  
  <pre><code>$em-&gt;getRepository('AlembicBioBundle:Categorie')-&gt;findOneByNom('PAINS');
  </code></pre>
  
  <p>It returns these results:</p>
  
  <pre><code>Alembic\BioBundle\Entity\Categorie Object
  (
      [nom:Alembic\BioBundle\Entity\Categorie:private] =&gt; PAINS
      [id:Alembic\BioBundle\Entity\Categorie:private] =&gt; 1
  )
  </code></pre>
  
  <p><code>PAINS</code> shouldn't have an id of 1...</p>
  
  <p>I also get strange outputs if I try: <code>$repo-&gt;findXXX()</code>.</p>
  
  <p><strong>Priorities:</strong> I would like to find a way for my <em>find()-based-methods</em> to start working correctly. The database schema update is a secondary problem... (if this is not directly related to the findXXX() problem).</p>