Note that there are some explanatory texts on larger screens.

plurals
  1. PODoctrine 1.2 hydration fails with HYDRATION_RECORD, but works with HYDRATION_ARRAY
    text
    copied!<p>I have a code that runs perfectly with <code>Doctrine_Core::HYDRATION_ARRAY</code>, but crashes with <code>Doctrine_Core::HYDRATION_RECORD</code>. The page is loading for about two minutes and shows standard browser error message, which is something like </p> <pre><code>Connection to the server was lost during the page load. </code></pre> <p>(I have localized browser, so that's not the exact error message, but translated).</p> <p>Using mysql command line <code>Show processlist</code> output</p> <pre><code>+-----+--------+-----------------+--------+---------+------+-------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +-----+--------+-----------------+--------+---------+------+-------+------------------+ | 698 | root | localhost:53899 | NULL | Query | 0 | NULL | show processlist | | 753 | *user* | localhost:54202 | *db1* | Sleep | 102 | | NULL | | 754 | *user* | localhost:54204 | *db2* | Sleep | 102 | | NULL | +-----+--------+-----------------+--------+---------+------+-------+------------------+ </code></pre> <p>The code itself:</p> <pre><code> $q = Doctrine_Query::create() -&gt;select("fc.*") -&gt;from("Card fc") -&gt;leftJoin("fc.Fact f") -&gt;where("f.deckid=?", $deck_id); $card = $q-&gt;execute(array(), Doctrine_Core::HYDRATE_RECORD); //Commenting the above line and uncommenting below line leads to an error //$card= $q-&gt;execute(array(), Doctrine_Core::HYDRATE_ARRAY); </code></pre> <p>So I think that query is not populated with correct SQL. Hovewer, <code>$q-&gt;getSqlQuery()</code> outputs the correct SQL that runs perfectly if executed via command-line or phpMyAdmin. </p> <p>Server configuration:</p> <pre><code>Apache/2.2.4 (Win32) mod_ssl/2.2.4 OpenSSL/0.9.8k mod_wsgi/3.3 Python/2.7.1 PHP/5.2.12 Mysql 5.1.40-community </code></pre> <p>Everything runs on localhost, so that's not a connection issue.</p> <p>The amount of data for that specific query is very small - about a dozen records, so it's nothing to do with memory or time limits. <code>safe_mode</code> is <code>off</code>, <code>display_errors</code> is <code>on</code> ,<code>error_reporting</code> is <code>6135</code>.</p> <p>Could somebody point to some hints or caveats I'm missing?</p> <p><b>UPDATE:</b> what's most weird that it works with <code>HYDRATION_RECORD</code> from time to time.</p> <p><b>UPDATE2:</b> it crashes when I'm trying to fetch something from the query, e.g. <code>getFirst()</code>. With no fetching it works, but I really don't need a query form which I can't fetch data.</p> <p><b>UPDATE3:</b> I've workarounded this issue, but I'm still interested, what's going on.</p> <p><strong>Update 4:</strong></p> <p>Sql query:</p> <pre><code>SELECT f.id AS f__id, f.createdat AS f__createdat, f.updatedat AS f__updatedat, f.flashcardmodelid AS f__flashcardmodelid, f.source AS f__source, f.content AS f__content, f.md5 AS f__md5 FROM flashcard f LEFT JOIN fact f2 ON f.id = f2.flashcardid AND (f2.deleted_at IS NULL) WHERE (f2.deckid = 19413) </code></pre> <p>Output:</p> <pre><code>f__id f__createdat f__updatedat f__flashcardmodelid f__source f__content 245639 2011-08-05 20:00:00 2011-08-05 20:00:00 179 jpod lesson 261 {"source":"\u7f8e\u5473\u3057\u3044","target":"del... </code></pre> <p>So, the query itself is OK, data fectched as expected. Do you need models definition?</p> <p><strong>Update 5</strong> When running query with <code>HYDRATE_RECORD</code> <code>httpd.exe</code> consumes 100% of one of the CPU cores.</p> <p><strong>Final Update</strong> Don't know why, but now it works... Haven't changed anything. Looks like it just was waiting when I place a bounty on this question. :) But still, as I already have placed a bounty, any idea of what's the difference between <code>HYDRATE_ARRAY</code> and <code>HYDRATE_RECORD</code> that might crash the script is appreciated.</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