[DC-436] Change in 1.2 to Doctrine_Event::skipOperation() functionality Created: 18/Jan/10 Updated: 10/Feb/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Relations |
| Affects Version/s: | 1.2.1 |
| Fix Version/s: | 1.1.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Cameron Ross | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Debian |
||
| Description |
|
I have been using Doctrine 1.1.6. I have two related models, which are always saved together. In my application, save is called on class A and that save cascades to class B. I have a save listener which in some cases can intercept class A's save operation and call Doctrine_Event::skipOperation() to prevent class A from being persistently saved. However, in such cases, class B is still saved - the skipOperation() does not skip the entire operation, just class A's save operation, allowing subsequent operations to occur as normal. This is the desired functionality and has been working fine. However, I have just upgraded to 1.2.1. only to find that something has changed, causing the skipOperation() to skip the entire operation, therefore not saving class B when class A's listener interferes. I presume this is a bug. If not, what precisely has changed with skipOperation(), and how can I keep the traditional functionality? |
[DC-254] getLimitSubquery Not Including All Order By Parts Created: 18/Nov/09 Updated: 27/Feb/11 |
|
| Status: | Reopened |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.0-BETA3 |
| Fix Version/s: | 1.2.0-RC1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Michael Card | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
The getLimitSubquery function is only including the first orderby field and ignoring all remaining parts. The function also needs to be changed to include mssql and odbc. The diff's below provide corrections. Thanks, Mike diff -r Doctrine-1.1.2\lib\Doctrine\Query.php Doctrine-1.1.2-Fixes\lib\Doctrine\Query.php 1367c1367 < if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci') { --- > if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'mssql' || $driverName == 'odbc') { 1371,1387c1371,1392 < $part_original = trim($e[0]); < $callback = create_function('$e', 'return trim($e, \'[]`"\');'); < $part = trim(implode('.', array_map($callback, explode('.', $part_original)))); < < if (strpos($part, '.') === false) { < continue; < } < < // don't add functions < if (strpos($part, '(') !== false) { < continue; < } < < // don't add primarykey column (its already in the select clause) < if ($part !== $primaryKey) { < $subquery .= ', ' . $part_original; < } --- > > foreach ($e as $f) { > if ($f == 0 || $f % 2 == 0) { > $part_original = trim($f); > $callback = create_function('$e', 'return trim($e, \'[]`"\');'); > $part = trim(implode('.', array_map($callback, explode('.', $part_original)))); > > if (strpos($part, '.') === false) { > continue; > } > > // don't add functions > if (strpos($part, '(') !== false) { > continue; > } > > // don't add primarykey column (its already in the select clause) > if ($part !== $primaryKey) { > $subquery .= ', ' . $part_original; > } > } > } |
| Comments |
| Comment by Michael Card [ 22/Dec/09 ] |
|
Additonal fix for this issue, was missing dblib originally. Mike diff -r Doctrine-1.1.2\lib\Doctrine\Query.php Doctrine-1.1.2-Fixes\lib\Doctrine\Query.php 1367c1367 < if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'mssql' || $driverName == 'odbc') { — > if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'mssql' || $driverName == 'odbc' || $driverName == 'dblib') { |
| Comment by Andrej Pavlovic [ 27/Feb/11 ] |
|
Come on guys, please include this fix into 1.2.4... |
[DC-403] Eliminate queries produced by Doctrine_Node_NestedSet::getDescendants() when possible Created: 06/Jan/10 Updated: 16/Apr/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Nested Set |
| Affects Version/s: | 1.2.1 |
| Fix Version/s: | 1.2.0 |
| Type: | Improvement | Priority: | Major |
| Reporter: | alex | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Description |
How to reproduce
Problem is described more verbosely here – http://codeutopia.net/blog/2008/08/30/understanding-doctrines-nestedset-feature/ What behavior is expectedAn already fetched record instance is returned, without calling database and without causing query flooding. Like in propel.In propel if you are calling ....::retrieveTree($id) it returns the root What happensAn additional query is issued This is a big slip in architecture of Doctrine`s nested set implementation. |
[DC-278] Invalid qubquery generated if using oracle adapter instead of pdo_oci Created: 23/Nov/09 Updated: 09/Jun/10 |
|
| Status: | Reopened |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.2.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Thomas Wahle | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux, Oracle 10g |
||
| Description |
|
Doctrine generates the following invalid subquery if oracle adapter is used (same query is generated corret if pdo_oci is used): SELECT DISTINCT "s2"."code" The problem is that the order by column is not part of the selected columns. Sample dql statement to reproduce this error: $this->pageAllPager = new Doctrine_Pager( |
| Comments |
| Comment by Jonathan H. Wage [ 23/Nov/09 ] |
|
I believe this is fixed now in the latest Doctrine 1.2. Can you test and confirm? |
| Comment by Thomas Wahle [ 24/Nov/09 ] |
|
It is not fixed with 1.2 RC1 Same sql wich work fine with pdo_oci generates an error using the oracle adapter <p> Failing Query: "SELECT s.code AS s_code, c.code AS ccode, c.name AS cname, c.is_activated AS cis_activated, c.is_deleted AS c_is_deleted FROM spend_category s INNER JOIN company_spend_category c2 ON (s.code = c2.spendcategory_code) INNER JOIN company c ON c.code = c2.company_code WHERE s.code IN (SELECT a.code FROM ( SELECT DISTINCT s2.code FROM spend_category s2 INNER JOIN company_spend_category c4 ON (s2.code = c4.spendcategory_code) INNER JOIN company c3 ON c3.code = c4.company_code WHERE s2.code = '37000000' AND c3.is_deleted IS NOT NULL AND s2.is_deleted IS NOT NULL ORDER BY c3.name desc ) a WHERE ROWNUM <= 10) AND (s.code = '37000000' AND c.is_deleted IS NOT NULL AND s.is_deleted IS NOT NULL) ORDER BY c.name desc"</p> |
| Comment by Jonathan H. Wage [ 24/Nov/09 ] |
|
I can't reproduce the issue in a test case. Can you help me with that? When I test what you're describing I get the results that are expected. |
| Comment by Thomas Wahle [ 25/Nov/09 ] |
|
Hi Jon, if i undestand the last comment correctly this issue will be fixed in 1.2 RC2. I have reviewed lots of existing test cases but did not find an example where pdo_oci or oracle adapter is used. Can you please forward the test case you have created for DC-278 to me? I will use this as a template for any further issues and hopefuly reduce your efforts. Kind regards > Jonathan H. Wage updated DC-278: |
| Comment by Thomas Wahle [ 10/Dec/09 ] |
|
I do believe that I have found the reason and it is still an issue with Doctrine 1.2.1 Doctrine generate the following subquery which is processed in Doctrine_Query:: getLimitSubquery(). SELECT b.id FROM This function replaces the table alias names. It looks like that the first occurance of "a" is detected and the inner alias for table attachment "a" is replaced by "a2" - that's fine. But also the outer table alias "a" is replaced by "a2" The result will be SELECT b.id FROM „a" is selected but the alias has been changed to „a2" and this will cause an sql error. It looks like that this bug will only raise if a table is used in the subquery which starts with an "a" |
| Comment by Thomas Wahle [ 11/Dec/09 ] |
|
As a workaround i have change "a" to "x" in the Doctrine_Connection_Oracle::_createLimitSubquery() As far as no table in our projekt starts with character "x" this works fine for me. By the way: Shouldn't it be $this->quoteIdentifier('a') . '.' instead of just a. ?? original code: modified code: |
| Comment by Jonathan H. Wage [ 08/Jun/10 ] |
|
Can you provide the change that fixes the problem for you as a diff so we can test it? |
| Comment by Thomas Wahle [ 09/Jun/10 ] |
|
Hi Jon, long time with no hear from you. Hope you are well! I am sorry, we did not fix this bug really. As writte above we have just implemented a work around by choosing a different character ("x" instead of "a") for the name of the generated sub query alias. This works fine with our data model (no table starts with "x") but may cause the same error with other data models. At all: There was too much trouble in this project last year. Due to this we made the decision to go ahead with pdo_oci to finish the project in time. Kind regards |
| Comment by Jonathan H. Wage [ 09/Jun/10 ] |
|
I'll leave this open if someone runs across the same problem, a test case showing the issue would help with pin pointing the problem area in the code. |
[DC-674] NULL Dates are translated to '0000-00-00' after upgrading to 1.2.2 Created: 10/May/10 Updated: 06/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Behaviors |
| Affects Version/s: | 1.2.1, 1.2.2 |
| Fix Version/s: | 1.2.1, 1.2.2 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Ville Itämaa | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Zend Framework, Ubuntu 9.10, MySQL |
||
| Description |
|
Once the upgrade was done from Doctrine 1.2.1 to 1.2.2 we discovered that date related issues started to appear. |
| Comments |
| Comment by Jonathan H. Wage [ 10/May/10 ] |
|
Are you able to reproduce this in a test case? |
| Comment by Ville Itämaa [ 11/May/10 ] |
|
We reverted to Doctrine 1.2.1 after realising the bug to confirm it was Doctrine 1.2.2 that was the cause for the problem. And as a result the records with NULL dates in the DB became NULL in the Models. |
| Comment by Jonathan H. Wage [ 11/May/10 ] |
|
Were you able to identity which changeset it was? You can read about creating test cases here http://www.doctrine-project.org/documentation/manual/1_2/en/unit-testing So far I am not able to reproduce the error you described. |
| Comment by Jonathan H. Wage [ 08/Jun/10 ] |
|
I'd like to fix this. Did you ever figure out which changeset introduced the issue? I've been trying to figure it out myself. |
| Comment by Roland Huszti [ 06/Oct/10 ] |
|
With 1.2.3 this works for me fine with both TIMESTAMP and DATE fields. YAML
date_of_birth:
type: date
BASE MODEL
$this->hasColumn('date_of_birth', 'date', null, array(
'type' => 'date',
// try these two
// 'notnull' => false,
// 'default' => null
));
YAML
exported_at:
type: timestamp(25)
notnull: false
default: null
# in this model I have everything to make sure it accepts and defaults to NULL
BASE MODEL
$this->hasColumn('exported_at', 'timestamp', 25, array(
'type' => 'timestamp',
'notnull' => false,
'length' => '25',
));
You may try adding these to your YAML and (base) models
YAML
fieldname:
. . .
notnull: false
default: null
BASE MODEL
$this->hasColumn('fieldname', . . .
. . .
'notnull' => false, // <<<<<<<
// 'default' => null, // <<< maybe, probably not needed
));
I hope it helps. |
[DC-553] issue when changing the connection inside Doctrine_Query::preQuery() on a model using a behavior Created: 08/Mar/10 Updated: 19/Jul/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Behaviors |
| Affects Version/s: | None |
| Fix Version/s: | 1.2.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Lukas Kahwe | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
We were following: class MyQuery extends Doctrine_Query public function preQuery() else { $this->_conn = Doctrine_Manager::getInstance()->getConnection('master'); } } However we are actually forcing all queries after the first access to the master to be run against the master (including selects). Note the example should probably be changed to use setConnection(). However even when using setConnection() it seems like changing the connection can cause issues when running a select on a model with a behavior (in our case we were using i18n). Therefore we believe there is some issue that is caused through the event system, because otherwise queries work just fine even when changing the connection as per the above described code. We managed to fix things, by not setting the connection explicitly and instead simply using setCurrentConnection('master'), so the bug does not affect us anymore. However this seems to indicate some issues deep inside the event-behavior-template code. |
| Comments |
| Comment by Jordi Boggiano [ 08/Mar/10 ] |
|
In case the above post is confusing, note that doing $this->_conn = masterconn worked fine for the INSERT, it just broke when doing a subsequent SELECT of a translateable (I18n behavior) model and its Translation table with the following exception: Exception (Exception): Unknown relation alias Translation (#0)</h1>thrown in file /Library/WebServer/Documents/liip/infocube/ext/db-doctrine/lib/Doctrine/Relation/Parser.php at line 237 |
| Comment by Jonathan H. Wage [ 15/Mar/10 ] |
|
It is hard to understand the issue, can you provide a test case? |
| Comment by Lukas Kahwe [ 15/Mar/10 ] |
|
We already spend well over 2 hours together on project time to find a work around as noted above and I must admit now our motivation is not so big to dig deeper, especially since we didn't find the cause in this time and have the feeling its pretty impossible to fix without huge risks. Essentially I think all you need to do to reproduce the issue is use the cookbook code
|
| Comment by Lukas Kahwe [ 17/Jun/10 ] |
|
we thought we had the issue fixed but ran into another issue today. we then noticed that the issue goes away if we just copy the $tables property from the old connection to the new connection. there is a getTables() method, but there is only a addTable() method, would be nice to have a addTables() method that is faster. or maybe a switchFrom() method that accepts the old connection and does whatever it needs to. And again it would be nice to update the cookbook entry. |
| Comment by Jordi Boggiano [ 19/Jul/10 ] |
|
We just had another funny debugging session related to this. It turns out that the Table objects have a relation to the connection, and if you query a new model that wasn't initialized yet using ->from(), it works because it just gets the current connection passed. However, if you query a new model within a JOIN, then it apparently takes the connection from the related model you're joining from. In our case, the related model was already initialized but had an instance of the old (slave) connection, and so the new model was initialized using the wrong connection, and then the DQL parser exploded trying to resolve relations. Long story short, adding $table->setConnection($conn); to all tables while switching to the master connection resolved it. The code is updated and you can still view it at the above URLs, or straight in the SVN repo at http://svn.liip.ch/repos/public/okapi2/ext/db-doctrine/trunk/inc/DQ.php |
[DC-769] Variable type different for return value from Doctrine_Record->toArray() depending on whether the object is from a select, or a save. Created: 27/Jun/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | 1.2.1 |
| Fix Version/s: | 1.2.1, 1.2.2, 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Dennis Gearon | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu9.10, PHP 5.2.6, Symfony 1.4.1, Postgres8.4 |
||
| Description |
|
With a object that is created via a save(), and the record's primary key is a INT fed by a SEQUENCE, the type of the variable is an INT. With an object that is hydrated from the database via a SELECT, the record's primary key INT will come back in 'toArray()' as a STRING. That means that checking for type has to know what context it came from, user, INSERT, or SELECT. Not fun. This also screws up converting arrays to JSON, 'cause the STRINGS get quotation marks and the INTS do not. As a general rule, everything FROM the database seems to be strings. Yes, I know, everything 'on the wire' or 'through a socket' comes out as text. And it's a lot faster to leave it that way. But having the type be different depending on the database operation? Not sure I like that. |
| Comments |
| Comment by Jonathan H. Wage [ 24/Aug/10 ] |
|
Can you provide a test case so that we can see if we can come up with a patch? |
[DC-651] [PATCH] Doctrine_Record::option('orderBy', ...) of join's right side being applied to refTable in m2m relationship Created: 26/Apr/10 Updated: 31/Aug/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query, Relations |
| Affects Version/s: | 1.2.2, 1.2.3 |
| Fix Version/s: | 1.2.2, 1.2.3, 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | suhock | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
CentOS 5.4 |
||
| Attachments: |
|
| Description |
|
When using the Doctrine_Record::option('orderBy', ...) feature on a table definition, where that table is the target of a many-to-many join, the specified orderBy columns are applied to the relation table's alias. So for example, given the following definitions: class User extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('uid', 'integer', null, array('primary' => true)); $this->option('orderBy', 'uid'); } public function setUp() { $this->hasMany('Group as groups', array('refClass' => 'UserGroup', 'local' => 'user_uid', 'foreign' => 'group_id')); } } class Group extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('gid', 'integer', null, array('primary' => true)); } public function setUp() { $this->hasMany('User as users', array('refClass' => 'UserGroup', 'local' => 'group_gid', 'foreign' => 'user_id')); } } class UserGroup extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('user_uid', 'integer', null, array('primary' => true)); $this->hasColumn('group_gid', 'integer', null, array('primary' => true)); } public function setUp() { $this->hasOne('User as user', array('local' => 'user_uid', 'foreign' => 'uid')); $this->hasOne('Group as group', array('local' => 'group_gid', 'foreign' => 'gid')); } } the following queries: $query = Doctrine_Query::create()
->select('u.*')
->from('User u')
->leftJoin('u.groups g WITH g.gid=?', 1);
echo $query->getSqlQuery() . "\n";
$query = Doctrine_Query::create()
->select('g.*')
->from('Group g')
->leftJoin('g.users u WITH u.uid=?', 1);
echo $query->getSqlQuery() . "\n";
will output the following:
The orderBy option() call is applied to the User definition. The SQL for the first query is correct (where User is on the left side of the join). The SQL for the second query (where User is on the right-most side of the join), however, is obviously incorrect (UserGroup doesn't even have a uid column). Basically, User's orderBy option is being applied to both the User table and its respective reference table, UserGroup, when it is the target of a join. After digging through the source for a while, I believe I've come up with a patch for this issue (which should be checked by someone more knowledgeable of Doctrine's internals). Basically, in the Doctrine_Query::buildSqlQuery() function, a call is made to Doctrine_Relation::getOrderByStatement() with the reference table (UserGroup)'s alias (u2), which in turn makes a call to Doctrine_Table::getOrderByStatement() on the referenced table (User), filling in the ORDER BY clause with User columns using UserGroup's alias. My solution was to reorder the logic so that the test for a reference class is made before the initial call to getOrderByStatement() is made. It seems to work against my test case and the test cases in the repository. I'll post my patch momentarily. This bug was first mentioned in the comments in DC-313, but the original ticket comes across as more of a feature request for the hasMany() orderBy feature. |
| Comments |
| Comment by suhock [ 26/Apr/10 ] |
|
attached a test case for this bug |
| Comment by suhock [ 26/Apr/10 ] |
|
patch against /branches/1.2 HEAD (should also work apply to 1.2.2 tag) |
| Comment by Dan Ordille [ 30/Aug/10 ] |
|
I can confirm this as an issue. However I don't think the above patch adequately fixes the problem it seems like with it an order by is still added for the ref column however the relation alias is lost. My query with the patch became I made an another patch that prevents this extra order by clause from being added and have attached it. |
| Comment by suhock [ 21/Sep/10 ] |
|
I tried out the new patch (Query_orderby_relation.diff), but it provides a reversed diff (patching goes from a patched version to the original). After applying it manually, it fails the provided test case and several additional test cases from the repository. The original patch DOES pass the provided test case, when applied against 1.2.2, 1.2.3, or the 1.2 branch from the repository. It does not pass, however, Doctrine_Query_Orderby_TestCase. As the previous poster mentioned, it fails to resolve aliases in instances where the 'orderBy' option is specified in a relation definition. I deleted the original patch and am providing a revised patch (Ticket_DC651.patch) against branch 1.2 HEAD (also works with 1.2.3), which fixes this issue. It passes all working test cases, including Doctrine_Query_Orderby_TestCase and DC651TestCase. |
| Comment by José De Araujo [ 31/Aug/11 ] |
|
I had this issue recently on a application I'm working on as described the oderBy option was applied on the joined table on a column that even doesn't exist in it. I used the DC651 patch provided and it solved the issue, so far I haven't seen any side effect to it. |
[DC-799] Doctrine_Query::parseFunctionExpression() produces unexpected results if the expression contains a function Created: 27/Jul/10 Updated: 27/Jul/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | 1.2.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Henning Glatter-Gotz | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac OS X, LINUX |
||
| Description |
|
When Doctrine_Query::parseFunctionExpression() is called with the following parameter and $this->_conn->expression is of type Doctrine_Expression_MySql: $expr = "DATE_FORMAT(datefield,'%Y-%m-%d'),someotherfield" The expected result from Doctrine_Query::parseFunctionExpressoin() would be DATE_FORMAT(l.datefield,'%Y-%m-%d'),l.someotherfield However, the actual result is DATE_FORMAT(l.datefield,'%Y-%m-%d'),someotherfiel Note the missing leading "l." and the last character ("d") on "someotherfield". This example is a result of calling addGroupby("DATE_FORMAT(datefield,'%Y-%m-%d'),someotherfield") on a Doctrine_Query object. |
[DC-795] Can't mix Soft and Hard deletes. Fix with patch provided. Created: 21/Jul/10 Updated: 21/Jul/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Behaviors |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | 1.2.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | John Wards | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Mac |
||
| Description |
|
I reported this bug on the symfony site, but after investigation i have found that it is actually a doctrine SoftDelete issue. http://trac.symfony-project.org/ticket/8898 I have a sandbox replicating the problem here: Run the test: The issue is I want to hard delete my M-M link table and soft delete the parents. This fails. I believe it is to do with the fact that the relations to the parent are marked as Doctrine_Record::STATE_TCLEAN which when the SoftDelete calls save on the parent object this flag trys to reinsert the relations that it has deleted. Things go very wrong at this point and the connection is rolled back. The fix I have is the following, not sure what this would do to other things or not as I am not overly familiar with Doctrine internals... Index: Doctrine/Template/Listener/SoftDelete.php
===================================================================
--- Doctrine/Template/Listener/SoftDelete.php (revision 12962)
+++ Doctrine/Template/Listener/SoftDelete.php (working copy)
@@ -95,6 +95,7 @@
public function postDelete(Doctrine_Event $event)
{
if ( ! $this->_options['hardDelete']) {
+ $event->getInvoker()->clearRelated();
$event->getInvoker()->save();
}
}
This works even if the relations have been marked as SoftDelete. |
| Comments |
| Comment by John Wards [ 21/Jul/10 ] |
|
Formatting |
| Comment by Jonathan H. Wage [ 21/Jul/10 ] |
|
Does this patch pass the test suite? |
| Comment by John Wards [ 21/Jul/10 ] |
|
I have run the test suite and got the same 8 failures with and without the patch. These are the failing tests: Anything obvious I need to do to get these working, other than enabling apc... |
| Comment by John Wards [ 21/Jul/10 ] |
|
It seems to be passing all the tests that have SoftDelete in them however, so I would say that it is working as expected. |
[DC-753] doctrine generate-migrations-diff throws "No php or yml files found at path" Created: 19/Jun/10 Updated: 27/Jan/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Migrations |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | 1.2.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | David Vega | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
WIndows 7 x64, WAMP, PHP 5.2.11 & 5.3 |
||
| Description |
|
I am trying to generate migrations from the CLI but I get the error mentioned in the title. I did some searching and this seems to have been a known problem and was fixed, however, I'm getting it and the path is correct, and there is even a schema.yml file I just generated, also through CLI. Here is the error: D:\wamp\www\project\src\administrator\components\com_project\doctrine>php doctrine generate-migrations-diff And here is what I have in my CLI file: require_once('../../../../libraries/doctrine/lib/Doctrine.php'); spl_autoload_register(array('Doctrine','autoload')); Doctrine_Manager::connection('mysql://root@localhost/project','default'); //Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_TBLNAME_FORMAT, 'jos_project_%s'); $cli = new Doctrine_Cli(array( $cli->run($_SERVER['argv']); I find this very weird because earlier today I was able to make a migration the same way but with Symfony's CLI, however, that is another project. Regards, David |
| Comments |
| Comment by Marcelo Saldanha [ 27/Jan/11 ] |
|
I have the same problem, using symfony 1.4 latest sources. After reading about 20 (long) pages about similar issues, I've come up with a solution. The problem appears when the project still don't have any Models defined. Im my case, they were all new projects in the plugin activation stage. Curiously, the behaviour were random, as in some projects I could activate my Contacts plugin (the first), and in others I couldn't. After much consideration, the problem was that the var $extension in /doctrine/Doctrine/Migration/Diff.php was empty, and that was because the algorithm only considered the first entry of the directory. If it was a file, its extension was used. If not, the algorithm descended until it found a file as the first entry. BUT it never considered second (and following) entries, so as my first entry was the 'base' directory, and it was empty, no extension was ever found. This probably will not happen if the project have some models defined. And so, I came up with a solution. In doctrine/Doctrine/Migration/Diff.php, enclose this code in the _getItemExtension method (near line 350, in my copy) with a loop, such as: else { $pathInfo = pathinfo($files[$idx]); $extension = $pathInfo['extension']; } $idx++; Now it keep looking in every folder until it finds a file WITH an extension, and stops when all the tree is searched. Hope that helps someone. best regards. |
[DC-740] issue with multiple connection handling Created: 16/Jun/10 Updated: 16/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Connection |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | 1.2.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Ian P. Christian | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
||||||||||
| Sub-Tasks: |
|
| Description |
|
I've found an issue where doctrine will use the wrong connection for tables under certain conditions. In a template, I'm doing a $sf_user->hasCredential() - which is causing this to be run in sfGuardSecurityUser, $this->user = Doctrine::getTable('sfGuardUser')->find($id);
When this execute, the calls find themselves to Doctrine_Manager::getConnectionForComponent($componentName) This method calls Doctrine_Core::modelsAutoload($componentName);, which fails to load the class, and returns false (no checking is done to see if it should return true). As this fails to include the sfGuardUser classes wher the component binding goes on, the getTAble call will use the default connection, then create the table fails to use the correct connection Doctrine_Core::getTable() return Doctrine_Manager::getInstance()->getConnectionForComponent($componentName)->getTable($componentName);
the binding is done after the call to getConectionForComponent, as it's getTable that will ultimately cause the autoloader to pull in the table classes. |
| Comments |
| Comment by Jonathan H. Wage [ 16/Jun/10 ] |
|
Hmm, why is the autoloading of sfGuardUser failing? I don't understand that part. If it is failing do you get a cannot load class error? |
| Comment by Ian P. Christian [ 16/Jun/10 ] |
|
The reason no autoload error is throw, is because symfony's autoloader loads the class for you, but it does it at the getTable() call, which as seen below from Doctrine_Core::getTable(), it's proxied though the connection - which is created before the gable is instanced, which of when the file is actaully loaded. return Doctrine_Manager::getInstance()->getConnectionForComponent($componentName)->getTable($componentName);
|
| Comment by Ian P. Christian [ 16/Jun/10 ] |
|
Just to expand on this... This obviously gets called when a call to getTable is made: public function getConnectionForComponent($componentName) { Doctrine_Core::modelsAutoload($componentName); if (isset($this->_bound[$componentName])) { return $this->getConnection($this->_bound[$componentName]); } return $this->getCurrentConnection(); } The autoload fails, as you can see from the code... public static function modelsAutoload($className) { if (class_exists($className, false) || interface_exists($className, false)) { return false; } if ( ! self::$_modelsDirectory) { $loadedModels = self::$_loadedModelFiles; if (isset($loadedModels[$className]) && file_exists($loadedModels[$className])) { require $loadedModels[$className]; return true; } } else { $class = self::$_modelsDirectory . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; if (file_exists($class)) { require $class; return true; } } return false; } $_modelsDirectory is never set, and $_loadedModelFiles is an empty array. The $_modelsDirectory, even if set, wouldn't handle loading for plugins, which put their models in places like lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardUser.class.php. |
| Comment by Ian P. Christian [ 16/Jun/10 ] |
|
This was not a problem before r7668 (at least, not for most use cases).... It used to be that null was passed as the first arg in the D_Query::create() method call, causing the query to figure out itself which connection to use, which was done after the component was bound, so that's fine! However, the code below is how it is in the current head public function createQuery($alias = '') { if ( ! empty($alias)) { $alias = ' ' . trim($alias); } $class = $this->getAttribute(Doctrine_Core::ATTR_QUERY_CLASS); return Doctrine_Query::create($this->_conn, $class) ->from($this->getComponentName() . $alias); } Here , the connection of the table (as explained above is previously set incorerctly) is passed to the query. |
| Comment by Ian P. Christian [ 16/Jun/10 ] |
|
I've found a work around to this, not sure if it's a desirable fix though... In the project configuration class, I've added this to the setup()
$this->dispatcher->connect('doctrine.configure', array($this, 'doctrineBinder'));
and the following method is also added, were I'm manually doing my bindings... public function doctrineBinder(sfEvent $event)
{
$manager = Doctrine_Manager::getInstance();
$manager->bindComponent('sfGuardUser', 'nosp');
$manager->bindComponent('Incident', 'nosp');
$manager->bindComponent('ServiceIp', 'ip');
}
The overhead here isn't really that high (it just sets an element in the array) - I'd also wonder if a bindComponents($array); should be added to simplify this call, but that's another method. |
| Comment by Marcel Berteler [ 06/Jul/10 ] |
|
After a long and hard look at the sfDoctrinePlugin and Doctrine code I can to the same conclusion. The Doctrine autoload is not working in sfDoctrinePlugin. I think this is more a sfDoctrinePlugin bug than a Doctrine bug. Instead of manual binding, a better way is the actually make sure the intended flow of the code is working like it should be. To be able to use sfDoctrineGuard with multiple connections you need to ensure that the connection name is added to the Schema of sfDoctrineGuard. Once this is done, rebuilding the model will put a bindComponent in the class files. This works fine if the autoload is working like it should. To get the autoload to work, you can extend the autoload function of Doctrine_Core in Doctrine: The Doctrine.php file is empty by default, so its easy to add your code to it (until the problem is fixed without having to edit Doctrine code) lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine.php:
class Doctrine extends Doctrine_Core
{
public static function modelsAutoload($className)
{
sfAutoload::getInstance()->autoload($className);
parent::modelsAutoload($className);
}
}
|
| Comment by Marcel Berteler [ 06/Jul/10 ] |
|
Sorry... the above does not work. Doctrine_Core->autoload() is called and not Doctrine->autoload(). sfAutoload::getInstance()->autoload($className); can be added to Doctrine_Core line 1133 public static function modelsAutoload($className)
{
if (class_exists($className, false) || interface_exists($className, false)) {
return false;
}
sfAutoload::getInstance()->autoload($className);
|
| Comment by Marcel Berteler [ 06/Jul/10 ] |
|
Oh, and to make sfDoctrineGuard work properly, you might have to ensure the sfBasicSecurityUser is bound to the correct model. You can do this in plugins\sfDoctrineGuardPlugin\lib\user\sfGuardSecurityUser.class.php or in apps\xxxxx\lib\myUser.class.php
Doctrine_Manager::getInstance()->bindComponent('sfGuardUser', 'connectionName');
|
| Comment by Marcel Berteler [ 07/Jul/10 ] |
|
The patch to Doctrine_Core This is a hack that only works when used in sfDoctrinePlugin / Symfony Not intended as the final patch to fix this bug but as a work around to make multiple connections usable. |
| Comment by Ian P. Christian [ 08/Jul/10 ] |
|
This effects migrations too it seems: Even doing this:
$manager = Doctrine_Manager::getInstance();
$manager->bindComponent('ChangeRequest', 'nosp');
$manager->bindComponent('change_request', 'nosp');
class Addstatetochangerequest extends Doctrine_Migration_Base
{
public function up()
{
$this->addColumn('change_request', 'change_state', 'enum', array('values' => array('draft', 'submitted', 'approved', 'rejected', 'closed')));
This results in:
# ./symfony doctrine:migrate
>> doctrine Migrating from version 0 to 1
The following errors occurred:
- SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nosp_test_radius2.change_request' doesn't exist. Failing Query: "ALTER TABLE change_request ADD change_state TEXT"
The database attempted to be used there is not the correct one. |
| Comment by Marcel Berteler [ 27/Sep/10 ] |
|
second required patch to make Symfony work with 2 concurrent databases |
| Comment by Eugeniy Belyaev [ 21/Oct/10 ] |
Another bad way to get it working in symfony:ProjectConfiguration.class.php public function configureDoctrine(Doctrine_Manager $manager)
{
$files = sfFinder::type('file')
->maxdepth(0)
->not_name('*Table.class.php')
->name('*.class.php')
->in(sfConfig::get('sf_lib_dir') . '/model/doctrine');
foreach ($files as $file) {
$class_name = str_replace('.class.php', '', basename($file));
Doctrine_Core::loadModel($class_name, $file);
}
}
|
| Comment by Dean de Bree [ 16/Nov/10 ] |
|
I found that if I changed the getTable function inside the Core.php file it seemed to work. Basically it forces the autoloader to load the object file, and when it does this it runs the bound connection statement to bind a table to a connection. Core.php /**
* Get the Doctrine_Table object for the passed model
*
* @param string $componentName
* @return Doctrine_Table
*/
public static function getTable($componentName)
{
if (!class_exists($componentName)) {
new $componentName();
}
return Doctrine_Manager::getInstance()->getConnectionForComponent($componentName)->getTable($componentName);
}
|
[DC-708] Wrong definition for MySQL string primary column Created: 28/May/10 Updated: 12/Jul/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Import/Export |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | 1.2.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Claudio Nicora | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PHP 5.3.1, WinXP-SP3, Doctrine 1.2.2, MySQL 5.1.41 |
||
| Attachments: |
|
| Description |
|
If you define a primary column, the attribute notnull is removed from the column definition because Doctrine assumes that primary columns are always not null. Now suppose you have a schema like this, with a string primary column. Client:
columns:
serial: { type: string(50), notnull: true, primary: true }
name: { type: string(36), notnull: true }
That's fine, but causes problems with MySQL where the column is created with a default value of "" (empty string) and not <none>. CREATE TABLE client (serial VARCHAR(50), name VARCHAR(36) NOT NULL, PRIMARY KEY(serial)) ENGINE = INNODB; Note that the 2nd column is well defined and has <none> as default value (as seen from phpMyAdmin). I attached a quick-workaround to disable the code which removes the notnull attribute from column definition. After that the SQL code is like this: CREATE TABLE client (serial VARCHAR(50) NOT NULL, name VARCHAR(36) NOT NULL, PRIMARY KEY(serial)) ENGINE = INNODB; |
| Comments |
| Comment by Claudio Nicora [ 28/May/10 ] |
|
Attached a better patch where the notnull attribute is removed only if the primary column type is string |
| Comment by Claudio Nicora [ 28/May/10 ] |
|
The same behaviour happens even for integer columns, so the notnull attribute should never be removed, not only for string columns. New patch attached, old one removed. |
| Comment by Jonathan H. Wage [ 08/Jun/10 ] |
|
The patch I see currently just comments out the offending code. Is that intended? It cannot be committed if so |
| Comment by Claudio Nicora [ 08/Jun/10 ] |
|
My patch only removed the effect, but it's not surely the best solution. I've no sufficient knowledge on Doctrine to say that commenting out (or removing) that line will not affect other parts; that's why I only commented out the code instead of removing it (both on my side and on the attached patch). If you think I'm not adding new bugs, I agree that removing the offending code is the cleanest way. |
| Comment by Jonathan H. Wage [ 08/Jun/10 ] |
|
We can't just remove the code. It will change the behavior of the builder drastically which breaks backwards compatibility. |
| Comment by Claudio Nicora [ 08/Jun/10 ] |
|
That's what I was afraid of. |
| Comment by Jonathan H. Wage [ 08/Jun/10 ] |
|
Hi, if you want to provide a patch that fixes your situation I can test it against our test suite and see if we can include it. You can also run your changes against the test suite to see if it causes any problems. |
| Comment by Claudio Nicora [ 13/Jun/10 ] |
|
Hi, I attached a patch against Export/Mysql.php instead of the previous against Import/Builder.php. |
[DC-1006] Custom geometric query error with orderBy Created: 22/May/11 Updated: 22/May/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Attributes |
| Affects Version/s: | 1.2.4 |
| Fix Version/s: | 1.2.2 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Leonardo Lazzaro | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Symfony 1.4.11 and Doctrine 1.2.4. Ubuntu 11.04 Apache2 with mod php5. php5 version PHP 5.3.5-1ubuntu7.2 with Suhosin-Patch |
||
| Description |
|
Mi Doctrine_Query with this Geometric Query fails with orderBy , but with where works. $distance = "glength(linestringfromwkb(linestring(GeomFromText('POINT( ".$object->getLatitude()." ".$object->getLongitude() .")'),l.point))) " This works: But this one fails at version 1.2.4, with older version was working. Well the problem is at line 74 of OrderBy.php : the rendered query in the distance has some ".", for example: then the after line 74 in OrderBy tries to search por '58' class. I manually added to DataDict in Mysql.php the POINT datatype (this fix solve me the problem in older versions of Doctrine). |
[DC-803] Syntax error in MySQL migration to drop constraint (patch supplied) Created: 29/Jul/10 Updated: 29/Jul/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Migrations |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | 1.2.2 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Gavin Davies | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Debian, PHP 5.3.2, MySQL |
||
| Attachments: |
|
| Description |
|
I have a migration that adds constraints correctly. When migrating down, however, I get a syntax error ErrorMessage Error #1 - SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONSTRAINT unique_username_idx' at line 1. Failing Query: "ALTER TABLE conUser DROP CONSTRAINT unique_username_idx" Here is the down migration: DownMigration public function down() { $this->dropConstraint('conUser', 'unique_username_idx'); } The SQL generated is "ALTER TABLE conUser DROP CONSTRAINT unique_username_idx". This post (http://forums.mysql.com/read.php?98,70887,70974#msg-70974) suggests that in MySQL the syntax should be "ALTER TABLE conUser DROP INDEX unique_username_idx" as constraints are basically indexes in MySQL (unlike MSSQL and Oracle). Doctrine's lib/Doctrine/Export/MySql.php appears to have a syntax error in the dropConstraint method. I attach a patch for this, but the only change is replacing "$name = 'CONSTRAINT '" with "$name = 'INDEX '" in dropConstraint. The migration then runs as I would expect. Sorry if this has been fixed elsewhere, I did a search but couldn't find a similar ticket. |
| Comments |
| Comment by Gavin Davies [ 29/Jul/10 ] |
|
fixing syntax |
[DC-1031] CLONE -Multiple connections and i18n (raised as unresolved - original ticket marked as resolved) Created: 23/Aug/11 Updated: 28/Mar/12 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Connection, I18n |
| Affects Version/s: | 1.2.2, 1.2.3 |
| Fix Version/s: | 1.2.3 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | James Bell | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MySQL 5.1.37 symfony 1.4.13 |
||
| Description |
|
I used to work with a single database named "doctrine". The query was working properly. I then decided to use 2 databases so I got my schema like this:
I did setup my connections in config/databases.yml this way:
build-model, build-forms, build-filters and cc got ran. But now, I got an exception saying the "Translation" relation doesn't exist. The Base Models include correctly the bindComponent line:
For now, I managed to kind of fixing it with simply swapping the databases order in my config/databases.yml and it's now working again perfectly. I forgot to mention that in the CategoryTable when i call $this->getConnection()->getName(), it outputs "second" |
| Comments |
| Comment by James Bell [ 23/Aug/11 ] |
|
Original issue: There are some additional comments in there that explain the issue as currently being seen in released versions of Doctrine 1.2. Can I help verify that this is the same ticket? What is needed to help with debug (in addition to the extra information already provided)? |
| Comment by Andy.L [ 28/Mar/12 ] |
|
meet the same issue and it really blocked my project, seems no one will maintain 1.x. I'm considering whether to replace symfony 1.4 with 2.0. |
[DC-1040] allow queries with table joins across different databases Created: 17/Nov/11 Updated: 17/Nov/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.3 |
| Type: | Improvement | Priority: | Blocker |
| Reporter: | Fabrice Agnello | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows XP SP3, Apache 2, PHP 5.3, MySQL 5.1.36, Symfony 1.4.8, Doctrine 1.2.3 |
||
| Attachments: |
|
| Description |
|
I'm currently working on a project which relies upon several databases declared in databases.yml in symfony 1.4.8. I was facing an issue that has already been raised by other people, namely that you can't join tables which reference each other among different mysql databases. I've dug a bit in the Doctrine_Query class and came to a solution that is acceptable for us, and allows now to make joins accross databases. Description follows : first change is in the Doctrine_Core class, that gets stuffed with a new constant : this constant allows us to add a new attribute to the databases.yml file as in :
after that, a few changes have been done in the Doctrine_Query class which is attached to this issue for the sake of readability. This may not be optimal, and probably need some regression testing, but it is currently working fine on our test server. after this is done, I was able to issue queries like the following : where the referenced tables are in different databases. The necessary object binding has been done in every model class following the paradigm : Doctrine_Manager::getInstance()->bindComponent('CdcIndInt ', 'gescdc'); I don't know if this description is clear enough, so let me know if something is missing/wrong. |
[DC-924] type mismatch for keyfield in column aggregation Created: 11/Nov/10 Updated: 11/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Inheritance |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Arnaud Morvan | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PostgreSQL |
||
| Description |
|
This is the doc exemple on column aggregation inheritance : Entity: User: Group: But the keyField (type) is created as VARCHAR(255) so PostgreSQL return an error on applying inheritance condition : SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: character varying = integer I found this with symfony sfFilebasePlugin on sfFilebase:create-root task. |
[DC-1004] ATTR_TBLNAME_FORMAT not used when creating models from database Created: 08/May/11 Updated: 08/May/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Import/Export |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.3, 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Robin Parker | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
if you set prefix to "xyz_%s" and have the model "BackgroundColor" it will become the table => "xyz_background_color" The fix (diff):
|
| Comments |
| Comment by Robin Parker [ 08/May/11 ] |
|
The diff output as .diff |
[DC-941] Spatial index type for mysql Created: 29/Nov/10 Updated: 29/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Import/Export |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.3 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Mishal | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
I'm using doctrine and some of mysql's spatial functions. I need to specify spatial index for my tables. Geometry:
Exporting this definitions throws an exception: Unknown type spatial for index geometry_idx |
[DC-1021] i am executing doctrine type query i am geting error please gave me reply Created: 24/Jul/11 Updated: 24/Jul/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | cherukuri | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
windows ,wamp,php |
||
| Description |
|
$query = new Doctrine_Query(); |
[DC-1034] ORA-00904 in Doctrine_Connection_Oracle Created: 01/Sep/11 Updated: 01/Sep/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Connection |
| Affects Version/s: | 1.2.4 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Jayson LE PAPE | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows 7 64 bits, PHP 5.2.11, Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi, Symfony 1.4.13 |
||
| Description |
|
When i execute this code:
$q = Doctrine_Query::create()
->from('AGENT ag')
->leftJoin('ag.CHANTIER_AGENT cag)
->orderBy('ag.nom')
->limit(10)
->offset(10)
->execute();
Doctrine executes : SELECT a.pk AS a__pk, a.ts AS a__ts, a.ck_agent AS a__ck_agent, a.matricule AS a__matricule, a.nom AS a__nom, a.prenom AS a__prenom, a.agent_maitrise AS a__agent_maitrise, c.pk AS c__pk, c.ts AS c__ts, c.ck_chantier_agent AS c__ck_chantier_agent, c.ek_chantier AS c__ek_chantier, c.fk_chantier AS c__fk_chantier, c.ek_agent AS c__ek_agent, c.fk_agent AS c__fk_agent FROM AGENT a LEFT JOIN CHANTIER_AGENT c ON a.ck_agent = c.ek_agent WHERE a.ck_agent IN (SELECT b.ck_agent FROM ( SELECT a.*, ROWNUM AS doctrine_rownum FROM ( SELECT DISTINCT a2.ck_agent, a2.nom FROM AGENT a2 LEFT JOIN CHANTIER_AGENT c2 ON a2.ck_agent = c2.ek_agent ORDER BY a2.nom ) a2 ) b WHERE doctrine_rownum BETWEEN 11 AND 20) ORDER BY a.nom The problem is in function _createLimitSubquery in Doctrine_Connection_Oracle :
$query= 'SELECT '.$this->quoteIdentifier('b').'.'.$column.' FROM ( '.
'SELECT '.$this->quoteIdentifier('a').'.*, ROWNUM AS doctrine_rownum FROM ( '
. $query . ' ) ' . $this->quoteIdentifier('a') . ' '.
' ) ' . $this->quoteIdentifier('b') . ' '.
'WHERE doctrine_rownum BETWEEN ' . $min . ' AND ' . $max;
Error occures, because table name is AGENT and Doctrine give the first letter of the table name for identifier.
$query = 'SELECT '.$this->quoteIdentifier('limb').'.'.$column.' FROM ( '.
'SELECT '.$this->quoteIdentifier('lima').'.*, ROWNUM AS doctrine_rownum FROM ( '
. $query . ' ) ' . $this->quoteIdentifier('lima') . ' '.
' ) ' . $this->quoteIdentifier('limb') . ' '.
'WHERE doctrine_rownum BETWEEN ' . $min . ' AND ' . $max;
|
[DC-1035] ORA-01791 due to bad driver name in Doctrine_Adapter_Oracle Created: 01/Sep/11 Updated: 01/Sep/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Connection |
| Affects Version/s: | 1.2.4 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Jayson LE PAPE | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows 7 64 bits, PHP 5.2.11, Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi, Symfony 1.4.13 |
||
| Description |
|
When i execute this code:
$q = Doctrine_Query::create()
->from('AGENT ag')
->leftJoin('ag.CHANTIER_AGENT cag)
->orderBy('ag.nom')
->limit(10)
->execute();
$q2 = Doctrine_Query::create()
->from('AGENT ag')
->leftJoin('ag.CHANTIER_AGENT cag)
->orderBy('ag.nom')
->limit(10)
->execute();
Doctrine executes : SELECT a.pk AS a__pk, a.ts AS a__ts, a.ck_agent AS a__ck_agent, a.matricule AS a__matricule, a.nom AS a__nom, a.prenom AS a__prenom, a.agent_maitrise AS a__agent_maitrise, c.pk AS c__pk, c.ts AS c__ts, c.ck_chantier_agent AS c__ck_chantier_agent, c.ek_chantier AS c__ek_chantier, c.fk_chantier AS c__fk_chantier, c.ek_agent AS c__ek_agent, c.fk_agent AS c__fk_agent FROM AGENT a LEFT JOIN CHANTIER_AGENT c ON a.ck_agent = c.ek_agent WHERE a.ck_agent IN ( SELECT a2.ck_agent FROM ( SELECT DISTINCT a2.ck_agent, a2.nom FROM AGENT a2 LEFT JOIN CHANTIER_AGENT c2 ON a2.ck_agent = c2.ek_agent ORDER BY a2.nom ) a2 WHERE ROWNUM <= 10) ORDER BY a.nom SELECT a.pk AS a__pk, a.ts AS a__ts, a.ck_agent AS a__ck_agent, a.matricule AS a__matricule, a.nom AS a__nom, a.prenom AS a__prenom, a.agent_maitrise AS a__agent_maitrise, c.pk AS c__pk, c.ts AS c__ts, c.ck_chantier_agent AS c__ck_chantier_agent, c.ek_chantier AS c__ek_chantier, c.fk_chantier AS c__fk_chantier, c.ek_agent AS c__ek_agent, c.fk_agent AS c__fk_agent FROM AGENT a LEFT JOIN CHANTIER_AGENT c ON a.ck_agent = c.ek_agent WHERE a.ck_agent IN ( SELECT a2.ck_agent FROM ( SELECT DISTINCT a2.ck_agent FROM AGENT a2 LEFT JOIN CHANTIER_AGENT c2 ON a2.ck_agent = c2.ek_agent ORDER BY a2.nom ) a2 WHERE ROWNUM <= 10) ORDER BY a.nom This causes "Oracle DB Error ORA-01791 not a SELECTed expression" because the sql query don't have a2.nom in SELECT DISTINCT and it's indispensable for ORDER BY a2.nom protected $attributes = array(Doctrine_Core::ATTR_DRIVER_NAME => "oci8", Doctrine_Core::ATTR_ERRMODE => Doctrine_Core::ERRMODE_SILENT); The problem is in Query.php line 1417 : if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'mssql' || $driverName == 'odbc') {
The driver name declared in Doctrine_Adapter_Oracle not in this conditional. protected $attributes = array(Doctrine_Core::ATTR_DRIVER_NAME => "oracle", Doctrine_Core::ATTR_ERRMODE => Doctrine_Core::ERRMODE_SILENT); An other problem is probably located at line 1409 if (($driverName == 'oracle' || $driverName == 'oci') && $this->_isOrderedByJoinedColumn()) { and 1497 if (($driverName == 'oracle' || $driverName == 'oci') && $this->_isOrderedByJoinedColumn()) { if don't correct the declaration of $attributes in Doctrine_Adapter_Oracle. |
[DC-791] [PostgreSQL] In case model is build from existing database sequence name is invalid and doctrine throw exception Created: 16/Jul/10 Updated: 25/Aug/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Schema Files |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Przemysław Ciąćka | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
symfony 1.4.5, postgresql 8.4, debian lenny, nginx |
||
| Attachments: |
|
| Description |
|
Firstly I created database directly in postgresql. When I try to insert new record to database I received following error: sequence "Category_id_seq" does not exist In schema file sequence name is defined like this: sequence: '"Address_id_seq"' In Category model file is same like above, apostrophes and quotes. When I remove quotes from sequence in model files everything is ok and there're no problems with insert new row to database. |
| Comments |
| Comment by Enrico Stahn [ 13/Aug/10 ] |
|
There are 2 solutions to your problem. The first is to change the sequence name in the schema, the second is to change the doctrine configuration. The default behavior of doctrine is to add a "_seq" to each sequence name. If you remove this part from you sequence name then it sould work as expected. The second option is to change the behavior of doctrine with the following configuration parameter: Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_SEQNAME_FORMAT, '%s'); default: Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_SEQNAME_FORMAT, '%s_seq'); |
| Comment by Przemysław Ciąćka [ 25/Aug/10 ] |
|
Problem are quotes in sequence name. Temporarly I fixed it by add str_replace() into importer from PostgreSQL - now in schema sequence names are without quotes. |
[DC-701] Aggregates functions do not return proper values when using many relationships and limits Created: 24/May/10 Updated: 01/Nov/10 |
|
| Status: | Reopened |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | will ferrer | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
XP Xamp |
||
| Attachments: |
|
| Description |
|
Hi All I have encountered a problem that seems very core to the way that doctrine works – if you apply an aggregate function to a column in a table and then join to another table via a many relationship while also using a limit, like so: $q = Doctrine_Query::create();
$q->from('Customer Customer');
$q->addSelect('COUNT(Customer.id) as COUNT_customer_id');
$q->addSelect('Customer_Order.id as order_id');
$q->leftJoin('Customer.Order Customer_Order'); // Many relationship here
$q->limit(20);
It produces this correct DQL: SELECT COUNT(Customer.id) as COUNT_customer_id, Customer_Order.id as order_id FROM Customer Customer LEFT JOIN Customer.Order Customer_Order LIMIT 20 However the SQL it produces will not return an accurate count – the count is restricted by the limit: SELECT COUNT(p.id) AS p__0, p2.id AS p2__1
FROM product_customers p
LEFT JOIN product_orders p2 ON p.id = p2.customer_id
WHERE p.id IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20')
This produces a count of 21 instead of what it should be (1000). The reason for this is because Doctrine's internal functionality does an intermediary query where it gets gets the ids needed from the customer table in order to use them as the IN portion of the constraints on the final query – like so: SELECT DISTINCT p3.id FROM product_customers p3 LIMIT 20 It may seem strange that I am applying a limit to a query which will aggregate to 1 to row . In the actual queries that alerted me to this problem I am using a group by. The reason I am not reporting this bug with a group by in my example however is that you can not use a group by with a many relationship and a limit in doctrine 1.2.2 as it works currently (see bug: Here is my sample schema in case its helpful. detect_relations: false package: Example options: type: INNODB charset: utf8 Order: tableName: orders columns: order_id: type: integer(4) primary: true notnull: true customer_id: type: integer(4) order_date: timestamp relations: Customer: type: one local: customer_id foreign: customer_id options: type: InnoDB Customer: tableName: customers columns: customer_id: type: integer(4) primary: true notnull: true autoincrement: true firstname: type: string(45) lastname: type: string(45) streetaddress: type: string(45) city: type: string(45) state: type: string(45) postalcode: type: string(45) relations: Order: type: many local: customer_id foreign: customer_id options: type: InnoDB Thanks much. Will Ferrer edit: split SQL code to make the discussion readable without huge horizontal scrolling... |
| Comments |
| Comment by Jonathan H. Wage [ 08/Jun/10 ] |
|
Is this still a problem? I am not sure if this can be patched easily. The limit subquery algorithm is flawed deeply but also a core part of the current way Doctrine 1 works. |
| Comment by will ferrer [ 08/Jun/10 ] |
|
Hi Jon This bug is still an issue for me but I think it may be VERY hard to patch since it seems very core to the way Doctrine 1 works. The project I am working on at the moment is a visual query builder that is highly reliant on Doctrine. In order to prevent users from making queries that would trigger this bug I am currently giving an alert when ever a query that would trigger this bug is created. It would be great if this were patchable but if not I should be able to get by. Does Doctrine 2 fix this problem? Thanks for the help. Will Ferrer |
| Comment by Jonathan H. Wage [ 08/Jun/10 ] |
|
In Doctrine 2 the limit subquery algorithm does not exist. It is now up to the developer to write the query to handle the scenario instead of Doctrine "trying" to automate it for you. Since the situation where it is needed it is so rare, and each case can be slightly different it is better to let the developer handle it in those cases. |
| Comment by will ferrer [ 08/Jun/10 ] |
|
Hi Jon Does that mean that Doctrine 2 can no longer intelligently handle limits with many relationships, and doesn't have the ability to hydrate a return with sub arrays in it for many relationships? Thanks again for your help. Will Ferrer |
| Comment by Jonathan H. Wage [ 09/Jun/10 ] |
|
That is correct. We do not automatically try and limit the relationships with a "limit subquery" as it causes more problems then it helps. |
| Comment by will ferrer [ 10/Jun/10 ] |
|
Hi Jon I was thinking about what you said here – that the "limit subquery" causes more harm than good. It occur to me that I really do like being able to use this method (it comes in very handy very often) but some times it would really help to be able to turn it off (the bug in this thread is a good example such a time). So I figured why not just make an option to turn it off and have the best of both worlds? I looked at the code and found it was really very easy to put in a property which can be set on the query object to enable or disable the use of the limit subquery. I made the change in my code base and found it very useful for several situations I was dealing with in my own project. The one thing I couldn't do is make a test case for this new feature – I couldn't find an existing test case that was actually triggering the limit subquery as I understood it to work (I couldn't find a test case that would put an WHERE IN constraint with all the ids gathered in the limit subquery. I tried some test cases that I THOUGHT would activate this feature but it didn't seem that they did). After adding this feature to my code base I also wanted a new hydrator – one that worked like scalar but would put in array key names that were the same as the ones you would see in HYDRATE_ARRAY. I noticed that HYDRATE_SCALAR already had the ability to do this but it required that a value of false be passed into the $aliasPrefix argument of the _gatherRowData function. I made a custom hydrator I call HYDRATE_ARRAY_SHALLOW that passes in this false value. I then realized this might be handy to add to doctrine so I integrated it into my code base and made a few test cases for it. There are 2 patches I am now attaching this to thread: disableLimitSubquery_2010-06-10_Doctrine_1.2_SVN.patch – this patch adds the disableLimitSubquery property to query objects so that users can turn off the use of the subquery for those times when they don't want to use that behavior (fixing the bug in this thread and probably others) and disableLimitSubquery_and_HYDRATE_ARRAY_SHALLOW_2010-06-10_Doctrine_1.2_SVN.patch – this is the same as the first patch but also contains the HYDRATE_ARRAY_SHALLOW hydration type I mentioned above (which tends to go well with disableLimitSubquery turned on). I put these in 2 patches incase you liked 1 feature but disliked the other. If you like either of this features I would be very happy to see them added to doctrine. Also if you have any advice on how to improve these features (or info on how to make a good test case for disableLimitSubquery) please let me know. Hope you are well. Will Ferrer |
| Comment by will ferrer [ 10/Jun/10 ] |
|
Reopened because I added a patch that I think in essence fixes the issues. |
| Comment by Jonathan H. Wage [ 01/Sep/10 ] |
|
Thanks for the issue and patches. Fixed here http://github.com/doctrine/doctrine1/commit/2ad78e62e360133efc04bf6897bf679c7f3d833b |
| Comment by will ferrer [ 01/Sep/10 ] |
|
individual patch for this issue with out other features included |
| Comment by will ferrer [ 01/Nov/10 ] |
|
adding test cases for these features |
| Comment by will ferrer [ 01/Nov/10 ] |
|
reopened because I posted some test cases to add to doctrine along with the patchs previously posted |
[DC-1007] Cannot update a field to NULL with MSSQL connection Created: 25/May/11 Updated: 25/May/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Connection |
| Affects Version/s: | None |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Critical |
| Reporter: | guitio2002 | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows 7 32 bits with Apache 2.2.x, PHP 5.2.17, Sql Server 2008, Symfony 1.4.11 and Doctrine 1.2.4 |
||
| Description |
|
When trying to update a field to NULL in a MSSQL database, Doctrine generates the following request: UPDATE table SET fieldThatMustBeNull = , anotherField = 'blabla'; therefore generating a syntax error. A fix would be to override the update method in the Doctrine_Connection_Mssql and add the following behavior: Doctrine_Connection_Mssql public function update(Doctrine_Table $table, array $fields, array $identifier) { if (empty($fields)) { return false; } $set = array(); foreach ($fields as $fieldName => $value) { if ($value instanceof Doctrine_Expression) { $set[] = $this->quoteIdentifier($table->getColumnName($fieldName)) . ' = ' . $value->getSql(); unset($fields[$fieldName]); } else if (is_null($value)) { $set[] = $this->quoteIdentifier($table->getColumnName($fieldName)) . ' = NULL'; unset($fields[$fieldName]); } else { $set[] = $this->quoteIdentifier($table->getColumnName($fieldName)) . ' = ?'; } } $params = array_merge(array_values($fields), array_values($identifier)); $sql = 'UPDATE ' . $this->quoteIdentifier($table->getTableName()) . ' SET ' . implode(', ', $set) . ' WHERE ' . implode(' = ? AND ', $this->quoteMultipleIdentifier($table->getIdentifierColumnNames())) . ' = ?'; return $this->exec($sql, $params); } |
[DC-1050] Doctrine_Relation_ForeignKey ignores ATTR_COLL_KEY attribute Created: 06/Mar/12 Updated: 07/Mar/12 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Attributes, Relations |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Uli Hecht | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows 7 64Bit |
||
| Attachments: |
|
| Description |
|
Doctrine_Relation_ForeignKey::fetchRelatedFor() executes the following code at line 70: $coll = $this->getTable() As you can see it accesses the first element by using index "0" in $coll and hence ignores a modified ATTR_COLL_KEY-setting, for instance: $this->setAttribute(Doctrine_Core::ATTR_COLL_KEY, 'id'); Fortunately I had two models (ForeignA and ForeignB) in my project which both have an one-to-one relation to a third model (Main). That helped me finding this bug which causes the following strange behavior: // program 1: $m = new Main(); // program 2: $m = Doctrine_Core::getTable('M1')->findOneBy('name', 'M1'); ------------------------- The big problem about this issue is that behavior is inconsistent. If you don't split the example above into two separate programs/processes you won't have problems, since Doctrine accesses the reference which was stored when calling save(). You will get into trouble using functional tests in Symfony. Since there is only a single process for all requests I wasn't able to reproduce a problem caused by this bug which appeared in the production environment. ------------------------- Edit: Doctrine_Connection::queryOne() is affected as well! A solution is to replace $coll = $this->getTable() by $related = $this->getTable() |
| Comments |
| Comment by Uli Hecht [ 07/Mar/12 ] |
|
Suggested patch |
[DC-898] (PATCH) Migration fails when addColumn with type 'boolean' used with default value, resulting in incorrect 'ALTER TABLE' query in MySQL Created: 22/Oct/10 Updated: 22/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Import/Export |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Jakub Argasiński | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac OS X 10.6 Snow Leopard / Zend Server CE 5.0.3 (irrelevant) |
||
| Attachments: |
|
| Description |
|
I use MySQL. In my up() method in migration class, I have: $this->addColumn($table, 'is_master', 'boolean', null, array('notnull' => true, 'default' => false)); Running 'migrate' results in a following exception: However, I would expect ALTER query to look like this: ALTER TABLE books_authors ADD is_master TINYINT(1) DEFAULT 0 NOT NULL I guess there's a problem with getDefaultFieldDeclaration() in Doctrine_Export_Mysql, it lacks convertBooleans() call being present at Doctrine_Export. |
[DC-881] Doctrine_Manager::parsePdoDsn() doesn't work properly [+patch] Created: 08/Oct/10 Updated: 08/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Connection |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Enrico Stahn | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Doctrine_Manager::parsePdoDsn('dblib:host=127.0.0.1:1433;dbname=foo') does not return proper results. patch and test case @ github |
[DC-856] Doctrine_Core::getPath() not working when inside phar, due to a bug in php Created: 03/Sep/10 Updated: 04/Jan/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Miha Vrhovnik | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
It seems that there is a bug in php, and realpath doesn't work when path is inside of phar archive. can be easily changed to |
| Comments |
| Comment by Pierre-Gildas MILLON [ 04/Jan/11 ] |
[DC-951] Error in generating the field size and error in the generation of the date fields for postgres Created: 24/Dec/10 Updated: 24/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | 1.2.4 |
| Type: | New Feature | Priority: | Major |
| Reporter: | fernando guerrero | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
apacha2, linux, Symfony 1.4 |
||
| Description |
|
collaboration of vtamara@pasosdejesus.org and jeronimo0000@gmail.com While we developed a tool with symfony 1.4 and postgresql database we found errors in the generated schema.yml which I describe below 1 - Error in generating of field size of varchars We found the following solution — Doctrine/Import/Pgsql.php.orig 2010-12-23 17:48:00.160271000 -0500
$decl = $this->conn->dataDict->getPortableDeclaration($val); |
[DC-944] Precedence problem in SQL generation allows bypass of pending joins Created: 03/Dec/10 Updated: 10/Dec/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Walter Hop | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PHP 5.2, 5.3 |
||
| Attachments: |
|
| Description |
|
'Pending join conditions' are used by listeners to inject extra SQL conditions into a query. They are often used to add basic constraints on every query. An example is the bundled SoftDelete template. Its listener adds extra constraints such as s.deleted_at IS NULL to a query, to make sure that deleted rows are never retrieved on a query. However, in the emitted SQL, Doctrine_Query does not use parentheses to group normal SQL conditions together. The pending join condition is simply added to the string without encapsulating existing expressions. This makes it possible to bypass the pending join conditions entirely by using the OR operator. Example For instance, the following query exhibits this problem:
This query emits the following SQL:
which returns also a deleted row. Expected behavior One would expect the pending join conditions always to hold, and to have precedence over regularly added SQL conditions. This could be accomplished in the most simple fashion by:
As the existing expressions are now encapsulated by parentheses, it is no longer possible to bypass the pending join conditions injected by the query listener. Full test case details: init.sql create database softdelete;
grant all privileges on softdelete.* to softdelete@localhost identified by 'uahwqeruwer';
use softdelete;
CREATE TABLE soft_delete_test (name VARCHAR(255),
deleted_at DATETIME DEFAULT NULL,
PRIMARY KEY(name)) ENGINE = INNODB;
insert into soft_delete_test values ('fine', null);
insert into soft_delete_test values ('faulty', now());
run.php <?php
require "./1.2.3/lib/Doctrine.php";
spl_autoload_register(array('Doctrine', 'autoload'));
require "SoftDeleteTest.php";
$conn = Doctrine_Manager::connection("mysql://softdelete:uahwqeruwer@localhost/softdelete");
$conn->setAttribute(Doctrine::ATTR_USE_DQL_CALLBACKS, true);
$query = Doctrine_Query::create()
->from("SoftDeleteTest")
->where("name=?", "faulty")
->orWhere("name=?", "faulty");
$found = $query->execute();
foreach ($found as $f) {
echo "ERROR! Found a deleted row: $f->name\n";
}
echo "Done.\n";
SoftDeleteTest.php (copied from Doctrine manual) <?php
class SoftDeleteTest extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', null, array(
'primary' => true
)
);
}
public function setUp()
{
$this->actAs('SoftDelete');
}
}
|
| Comments |
| Comment by Walter Hop [ 03/Dec/10 ] |
|
Fixing quote formatting |
| Comment by Walter Hop [ 03/Dec/10 ] |
|
Final formatting fixes. |
[DC-1022] Doctrine migration does not set version when MySQL autocommit is false Created: 26/Jul/11 Updated: 26/Jul/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Migrations |
| Affects Version/s: | None |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Adam Fineman | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
RHEL 6.0, mysql 5.1.52 |
||
| Attachments: |
|
| Description |
|
With autocommit set to off in mysqld, Doctrine_Migration::setCurrentVersion() does not have any effect. This is because the method uses raw PDO calls, which are discarded without either autocommit or an explicit COMMIT;. We patched Doctrine as in the attachment. It works for us, but may not be the best general solution. The patch only fixes this one issue. There are likely many areas in Doctrine that rely upon autocommit behavior in MySQL. We will continue to look for them, and supply patches as we find them. However, as we are only concerned about MySQL, our solutions will probably not apply to other PDO drivers. |
[DC-1048] MSSQL Connection Created: 16/Jan/12 Updated: 16/Jan/12 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Connection |
| Affects Version/s: | 1.2.4 |
| Fix Version/s: | 1.2.4 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Constantine Tkachenko | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Microsoft Windows Server 2008 R2; IIS 7; PHP 2.3.8; Doctrine 1.2.4; Symfony 1.4.16 |
||
| Description |
|
Function spliti(); is deprecated. $field_array = str_ireplace(' as ', ' as ', $field_array); thnx. |
[DC-1046] Connection MSSQL replaceBoundParamsWithInlineValuesInQuery Created: 15/Dec/11 Updated: 15/Dec/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Peter Eisenberg | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Revision: 104 |
||
| Attachments: |
|
| Description |
|
Hello, We found a bug in Doctrine1 MSSQL Connection. Please find the patch for it, I hope it helps to you as well. Kind regards |
| Comments |
| Comment by Peter Eisenberg [ 15/Dec/11 ] |
|
Small changes: please use the following instead of the original: another case you got the following error: Use of undefined constant xxx - assumed xxx. Kind regards, |
[DC-831] Importing fixtures fails when GoogleI18n used with "Couldn't create collection index. Record field 'lang' was null." Created: 17/Aug/10 Updated: 13/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Data Fixtures, I18n, Import/Export |
| Affects Version/s: | 1.2.2, 1.2.3 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Jakub Argasiński | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac OS X 10.6.4, Zend Server CE 5.0.2 (irrelevant, I guess) |
||
| Attachments: |
|
| Description |
|
There's a problem with Doctrine_Data_Import. When trying to load a fixture record with translations, and GoogleI18n (or similar) instead of I18n is used (via actAs()), the following crash happens: #0 /Users/argasek/Sites/fwm/library/doctrine/Doctrine/Access.php(131): Doctrine_Collection->add(Object(Fwm_Shop_Catalog_CategoryTranslation)) I have narrowed down the problem to the line 135 of Doctrine/Data/Import.php, ie. if ($table->hasRelation($key) && is_array($value) && ! $table->hasTemplate('Doctrine_Template_I18n')) { In case of GoogleI18n, $table->hasTemplate('Doctrine_Template_I18n') returns false. I have no idea how to patch this in a sane way. Adding another condition (&& ! $table->hasTemplate('Doctrine_Template_GoogleI18n') serves well as a workaround, but such condition would be required for any class similar to Doctrine_Template_GoogleI18n. I guess the condition should check if it's a Doctrine_Template_I18n template or any template iherited from this class?... |
| Comments |
| Comment by Jakub Argasiński [ 17/Aug/10 ] |
|
I have provided a quick workaround patch for this problem, with an approach described in my report, ie. checking whether table has a template being an instance of or a child of Doctrine_Template_I18n. |
[DC-828] MSSQL - ORDER BY on text columns throws mssql error 306 [+patch] Created: 16/Aug/10 Updated: 02/Sep/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | 1.2.4 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Enrico Stahn | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Throws: Server: Msg 306, Level 16, State 2, Line 1
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
Solution:
References:
Patch will be supplied soon ... |
| Comments |
| Comment by Enrico Stahn [ 20/Aug/10 ] |
|
http://github.com/estahn/doctrine1/compare/DC-828 I guess we need more TestCases for the SubQuery stuff. |
| Comment by Enrico Stahn [ 02/Sep/10 ] |
|
I made a mistake with github, the updated branch can be found at |
[DC-825] Versionable does not work with column alias on primary keys [+patch] Created: 13/Aug/10 Updated: 25/Aug/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Behaviors |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Enrico Stahn | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Using the Versionable behavior on a model which has a column with an alias and which is also primary causes the generation of a wrong version of the versionable table. Example: ModelFoo: model_id as id username password Generates tables: It should be: |
| Comments |
| Comment by Enrico Stahn [ 13/Aug/10 ] |
|
TestCase and Fix |
| Comment by Enrico Stahn [ 18/Aug/10 ] |
|
The supplied patches are not up-to-date. Pls use http://github.com/estahn/doctrine1/tree/DC-825 |
[DC-758] CascadeDelete not work properly on Versionable and on the AuditLog Created: 21/Jun/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Behaviors |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Jaime Suez | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac OS X Snow Leopard, LAMP and Macports |
||
| Description |
Schema:
Personal:
actAs:
Versionable:
deleteVersions: false
cascadeDelete: false
When you use this configuration and try to delete one of the record linked with the versionned one, an exception about foreign key is raised because the id of the versioned record has a foreign key to the id of the record. It's necessary to could work with cascadeDelete: false... because like that it's needed to use softDelete and the deleted record's will be stored on the version table, but with the advantage that you don't have the performance problem of soft delete behaviour. Thanks! |
[DC-756] Cannot use named parameters in a 'limit(':max') clause Created: 21/Jun/10 Updated: 07/Sep/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Dennis Gearon | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
ubuntu, apache, symfony version 1.4.4 |
||
| Attachments: |
|
| Description |
|
$modulus=5; This works This does not, it gets the whole table |
| Comments |
| Comment by Dennis Gearon [ 24/Jun/10 ] |
|
I noticed an error in the code, which does not solve the problem, only confuse whomever works on it $maxDaysDetailsToProcess=3; as the fourth line in the code. |
| Comment by Juan Antonio Galán [ 07/Sep/10 ] |
|
I think I found a solution but it's making some tests fail. Let me explain you what I did: First I removed any casting to int of the limit value, in order to keep the named parameter in the LIMIT part of the query. Actually this named parameters were converted to 0 due to those int castings. Then I realized that the params are bound as strings so the resulting query looks like ... LIMIT "2" or whatever you put in the limit value, and mysql throws and error. Then I tryed to modify the function that binds the paramters to bind them as integers when they're not strings. Everything seems to work fine and you could put named parameters in the limit clause, but some tests are failing. If you look at the tests that are failing you'll see that they're failing because of a wrong phone number, the test it's expecting a number large number like 6155139185 but the result array has a number like 1860171889. I'm wondering if there's something wrong when binding numbers bigger than mysql INT as integers. I attach a diff file with the changes I did, hope it helps |
[DC-741] Sort of Migration Class Problem With More Than 9 Classes Created: 16/Jun/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Cli |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Dolly Aswin Harahap | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 10.04, PHP 5.3.2, Doctrine 1.2.2 |
||
| Attachments: |
|
| Description |
|
I have problem when do a migration with more than 9 classes. (Version1, Version2, Version3, ..., Version10) php doctrine-cli.php migrate 10 When migration class lower than 10, migration well done. I have do a simple research, and found the problem is on the sort of the class name. So, I change the sort method to Natural Sort, to fix this issue. |
| Comments |
| Comment by Dolly Aswin Harahap [ 16/Jun/10 ] |
|
Here I attach patch to fix this issue. Please check it. |
| Comment by Jonathan H. Wage [ 24/Aug/10 ] |
|
I am not able to produce the error, things are always in the correct order. I added a test here: http://trac.doctrine-project.org/changeset/7683 Can you help me with how to reproduce the error? |
[DC-883] Help for Test CLI does not list available test groups Created: 10/Oct/10 Updated: 10/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Andrew Coulton | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The CLI Test Runner is supposed to print a list of available test groups when used with the --help parameter, but this fails as the Doctrine_Test::run() method erroneously expects php sort() to return an array rather than a boolean. Fixed by http://github.com/acoulton/doctrine1/tree/DC-883 |
[DC-879] MSSQL - missing function date_part() in Expression/Mssql.php [+patch] Created: 05/Oct/10 Updated: 05/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Connection |
| Affects Version/s: | 1.2.2, 1.2.3 |
| Fix Version/s: | 1.2.4 |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Enrico Stahn | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Missing function date_part() in Expression/Mssql.php. I don't know why the set of expressions is different for each driver. This makes it hard to develop database independent. |
[DC-852] CLONE -Fix returned type value : SQL integers to PHP integers when getting a value from the database. Created: 01/Sep/10 Updated: 02/Sep/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Attributes, Data Fixtures, Native SQL, Query, Record |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.4 |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Enrico Stahn | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hi Jon, I have a request for you to improve Doctrine. When declaring a column as an integer, it seems that Doctrine returns a string when getting the value of that column. For example, if I have a "status" column, which can take 0, 1 or 2 as its value, Doctrine will return these values as string, which is not really logical and returning the good PHP type is the goal of an ORM. I'm fond of the triple equal symbol to test a value and I did not understand why this did not work at start : // in my myModel class public function isValidated() { return self::STATUS_VALIDATED === $this->getStatus(); }} That's why getStatus() gives me a string instead of an integer, whereas the column is declared as an integer in my schema. I'm forced to cast myself the returned value of getStatus() in my model. |
| Comments |
| Comment by Enrico Stahn [ 01/Sep/10 ] |
|
Proposal for a solution: http://github.com/estahn/doctrine1/compare/master...DC-852 |
| Comment by Jonathan H. Wage [ 01/Sep/10 ] |
|
So if you enable this attribute you live with the fact that casting a string to an integer that is longer than php max integer will give weird results? |
| Comment by Enrico Stahn [ 02/Sep/10 ] |
|
i'm far from happy with this solution. if an integer that is greater than php max int gets casted it will be casted into a value of type double. if you enable that attribute only values that could successfully casted into an integer will be casted otherwise an exception will be thrown. |
[DC-843] MSSQL - Equal-to Operator doesn't work with columns of type text in where condition [+patch] Created: 26/Aug/10 Updated: 02/Sep/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Connection |
| Affects Version/s: | 1.2.2, 1.2.3 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Enrico Stahn | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Example: Doctrine::getTable('Ticket_DCXXX2_Model')->findByUsernameAndFoo('foo', 'bar');
foo is of type "text". Doctrine generates "where .... foo = 'bar'", but this will throw an mssql exception because you cant use the equal to operator in mssql for text and varchar types. Doctrine should consider this database related behavoir, shouldn't it? |
| Comments |
| Comment by Enrico Stahn [ 26/Aug/10 ] |
|
TestCase added http://github.com/estahn/doctrine1/compare/master...DC-843 |
| Comment by Enrico Stahn [ 27/Aug/10 ] |
|
Patch added to github (see above) commit msg: DC-843 fix (TestCase need fix for DC-841 to run successfully) |
| Comment by Enrico Stahn [ 02/Sep/10 ] |
|
I made a mistake with github, the updated branch can be found at |
[DC-1003] _processWhereIn does not allow the use of named query parameters Created: 05/May/11 Updated: 06/May/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | None |
| Fix Version/s: | 1.2.4 |
| Type: | Improvement | Priority: | Minor |
| Reporter: | alex pilon | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
karmic, php 5.2.10, apache2 |
||
| Attachments: |
|
| Description |
|
When writing a query such as
you are unable to then
Doctrine complains that you may not mix positional and named query parameters. The attached patch fixes this by checking if the key of the passed in parameter is non numeric and if so setting the "value" of the parameter place holder to the value of the key. |
| Comments |
| Comment by alex pilon [ 05/May/11 ] |
|
I discovered an issue with the above patch. I am working on a better version. |
| Comment by alex pilon [ 06/May/11 ] |
|
Here is a second version.. it is a little bit sloppy. Is there a resource I can find on here that will help me to improve code quality/unit test this? |
[DC-840] MSSQL - strange behavior with multiple addWhere conditions and ">" [+patch] Created: 25/Aug/10 Updated: 27/Aug/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Connection |
| Affects Version/s: | 1.2.2, 1.2.3 |
| Fix Version/s: | 1.2.4 |
| Type: | Bug | Priority: | Trivial |
| Reporter: | Enrico Stahn | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In the first example below the second parameter wasn't replaced by the given value. I tracked it down and i suppose it's because of the ">" sign. It's the same for "<". Equal-Operator (=) works fine. $q = Doctrine_Query::create()
->select('password, modified_at')
->from('Ticket_DCXXX_Model')
->andWhere('password = ?', 'abc')
->andWhere('modified_at > ?', '2010-01-01')
SELECT [t].[id] AS [t__id], [t].[password] AS [t__password], [t].[modified_at] AS [t__modified_at] FROM [ticket__d_c_x_x_x__model] [t] WHERE ([t].[password] = 'abc' AND [t].[modified_at] > ?) $q = Doctrine_Query::create()
->select('password, modified_at')
->from('Ticket_DCXXX_Model')
->andWhere('modified_at > ?', '2010-01-01')
->andWhere('password = ?', 'abc')
SELECT [t].[id] AS [t__id], [t].[password] AS [t__password], [t].[modified_at] AS [t__modified_at] FROM [ticket__d_c_x_x_x__model] [t] WHERE ([t].[modified_at] > '2010-01-01' AND [t].[password] = 'abc') |
| Comments |
| Comment by Enrico Stahn [ 25/Aug/10 ] |
| Comment by Enrico Stahn [ 27/Aug/10 ] |
|
see DC-841 |
[DC-926] Doctrine ignored PORTABILITY_FIX_CASE and ATTR_FIELD_CASE settings when building query Created: 12/Nov/10 Updated: 12/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Dziamid Zayankouski | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Tested on CentOS 5, Ubuntu 10.4, MYSQL and MSSQL databases |
||
| Description |
|
Setting: I expect column names in built queries to be uppercase, but they remain to be lowercase. |
[DC-918] Causing ORA-01791 when try to sort on relation field and use limit in query to Oracle DB Created: 06/Nov/10 Updated: 06/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Dmitriy | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
Windows 2003 Server, Oracle 10g, Symfony 1.4.8 |
||
| Description |
|
Schema in yml format PrType:
columns:
name: { type: string(255), notnull: true }
PrTypeTranslation:
columns:
id: { type: integer, notnull: true }
name: { type: string(255), notnull: true }
lang: { type: string(255), notnull: true }
relations:
PrType: { onDelete: CASCADE, local: id_id, foreign: id, foreignAlias: Translation }
When i try to execute this code: $q = Doctrine_Query::create()
->from('PrType tp')
->leftJoin('tp.Translation t WITH t.lang = ?', 'ru')
->orderBy('t.name')
->limit(10);
doctrine executes next statement: SELECT "p"."id", "p2"."name" AS "p2__name", "p2"."lang" AS "p2__lang" FROM "pr_type" "p" LEFT JOIN "pr_type_translation" "p2" ON "p"."id" = "p2"."id" AND ("p2"."lang" = :oci_b_var_1) WHERE "p"."id" IN ( SELECT a."id" FROM ( SELECT DISTINCT "p3"."id" FROM "pr_type" "p3" INNER JOIN "pr_type_translation" "p4" ON "p3"."id" = "p4"."id" AND ("p4"."lang" = 'ru') ORDER BY "p4"."name" ) a WHERE ROWNUM <= 10) ORDER BY "p2"."name" This sql code produces next error ORA-01791: not a SELECTed expression Error occures, because (from ORACODE)
|
| Comments |
| Comment by Dmitriy [ 06/Nov/10 ] |
|
Some very similar issue were reported and resolved here http://trac.doctrine-project.org/ticket/1038. |
| Comment by Dmitriy [ 06/Nov/10 ] |
|
Reason of issue was founded. It appears because i'm using oci8 driver, and this drivername not be listed in if statement on line 1401 in Doctrine/Query.php:
LINE 1401: if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'mssql' || $driverName == 'odbc') {
I changed to: LINE 1401: if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'oci8' || $driverName == 'mssql' || $driverName == 'odbc') {
Sorry, but i don't know how to create patch diff file. |
[DC-860] 0 down vote favorite In some circumstances Doctrine_Core::getTable('%Name%') returns Doctrine_Table instance instead of %Name%Table one. Created: 06/Sep/10 Updated: 06/Sep/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Relations |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Hong Kil Dong | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
WinXP, Apache, PHP 5.2.14 |
||
| Description |
|
In some circumstances Doctrine_Core::getTable('%Name%') returns Doctrine_Table instance instead of %Name%Table one. In order to give a demonstration of this improper behavior : here is a schema of small issue tracking system User: user_name: { type: string(255) }user_role: { type: enum, values: [worker, dispatcher, manager] }managed_by: { type: integer }password: { type: string(32) }salt: { type: string(32) } relations: Issue: from_ceh: { type: string(255) }from_name: { type: string(255) }from_phone: { type: string(255) }from_location: { type: string(255) }comp_name: { type: string(255) }comp_serial: { type: string(255) }comp_os: { type: enum, values: [Win95, Win98, WinNT, WinME, Win2000, WinXP, Vista, Win7] }issue_title: { type: string(255) }comment: { type: string(255) }owner_id: { type: integer }is_executed: { type: bool } relations: When I just call Doctrine_Core::getTable('User') it returns UserTable instance, but if I call it after such a query: Doctrine_Query::create() calling Doctrine_Core::getTable('User') returns Doctrine_Table instance |
[DC-972] MySQL field aliases with triple ticks Created: 16/Feb/11 Updated: 16/Feb/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Roland Huszti | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
MySQL 5, PHP 5 |
||
| Attachments: |
|
| Description |
|
In revision 7691 something has happened. Ever since I updated my Doctrine to that revision all my queries having " ... fieldname AS aliasname ... " go crazy and make the PHP to throw an exception, like this: 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 't.`id`' in 'field list'. Failing Query: The problem is that the DQL parser somewhere along the process encapsualtes aliases in ticks, but then it does it again in lib/Doctrine/Formatter.php : quoteIdentifier() , which is called in lib/Doctrine/Connection : quoteIdentifier() , which is called in lib/Doctrine/Query.php : processPendingFields() @ between lines 485 and 512. The problem is that by the time the alias name gets to line 507 it is already encapsualted in ticks, but it does it again. At the end we end up with ```alias``` , which is not good. It only happens to aliases. If I say select('*') or select("t.id, t.name") then it executes properly. Only the aliases couse problems. A test query: $vTerritories = Doctrine_Query::create() MY PROPOSED PATCH: If I change the Formatter::quoteIdentifier() to this: public function quoteIdentifier($str, $checkOption = true) { $tmp = $this->conn->identifier_quoting; // I move up this line to here because I need it if ( (substr($str, 0, 1) == $tmp['start']) && (substr($str, -1) == $tmp['end']) ) return $str; // new line; is it already quoted? if yes, then don't do it again // the rest is unchanged }then it works correctly. Please note I only tested that in MySQL, as we use MySQL in all our projects. |
[DC-962] Broken logic when doctrine translates limit's into subqueries, with joins. (with patch) Created: 02/Feb/11 Updated: 02/Feb/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Ben Davies | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
All |
||
| Attachments: |
|
| Description |
|
Problem exists when Doctrine formulates a subquery to perform a limit when a join in included. The problem is that the where clause that doctrine creates for the subquery (the WHERE IN clause) is inserted as the first where clause. Consider: select * from table join metadata WITH c = ? where a = ? and b = ? limit 1 with parameters be (1, 2, 3) Doctrine will translate this to
select * from table
join metadata WITH c = ?
where table.id IN (
select id from table
join metadata WITH c = ?
where a = ? and b = ?
limit 1
)
and a = ? and b = ?
Doctrine will duplicate the params (Doctrine_Query_Abstract:969) to (1, 2, 3, 1, 2, 3), but now they are in the wrong order completely. The easy fix is to move the limit subquery to the LAST where clause, which would reuslt in a query like so:
select * from table
join metadata WITH c = ?
where a = ? and b = ?
and table.id IN (
select id from table
join metadata WITH c = ?
where a = ? and b = ?
limit 1
)
Attached is a patch to fix this issue, along with a patch that fixes all unit tests referring to the old query format. |
| Comments |
| Comment by Ben Davies [ 02/Feb/11 ] |
|
upping to blocker since this breaks very basic queries |
[DC-952] Non-Equal Nest Relations Not Working - from "Children" side Created: 03/Jan/11 Updated: 24/Mar/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Record, Relations |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Paweł Barański | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | None | ||
| Environment: |
Ubuntu 10.04 + PHP 5.3.3 + Symfony 1.4.8 |
||
| Attachments: |
|
||||||||||
| Sub-Tasks: |
|
| Description |
|
I've copy & pasted example from http://www.doctrine-project.org/projects/orm/1.2/docs/manual/defining-models/1_0#relationships:join-table-associations:self-referencing-nest-relations:non-equal-nest-relations . 1. Add 3 User objects (A,B,C) As a result you will see only C set as Children, and strange situation in database : UserReference Table: parent_id | child_id |
| Comments |
| Comment by Paweł Barański [ 06/Jan/11 ] |
|
Same ticket on symfony trac because I'm not sure whose fault is it http://trac.symfony-project.org/ticket/9398 Also some new error path there |
| Comment by Daniel Reiche [ 24/Mar/11 ] |
|
Test Case of Non-Equal Self-Referencing Relations, based on #DC-329. Failure occures in line 75 of the test case file. This should not happen! |
[DC-1025] Doctrine is unable to handle table names with spaces Created: 02/Aug/11 Updated: 02/Aug/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | 1.2.1, 1.2.2, 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Daniel Borg | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PHP Version 5.2.14 |
||
| Attachments: |
|
| Description |
|
When trying to query a table which contains spaces I get the following exception I have attached an simple example to reproduce C:\Documents and Settings\daniel\Dokumenter\NetBeansProjects\test>php doctrineTest.php Fatal error: Uncaught exception 'Doctrine_Query_Exception' with message 'Unknown table alias with' in C:\Doctrine-1.2.3\Doctrine\Query\Abstract.php:856 thrown in C:\Doctrine-1.2.3\Doctrine\Query\Abstract.php on line 856 |
[DC-313] Ordering m2m relationship with column from related table (with orderBy option) Created: 02/Dec/09 Updated: 18/Feb/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Record, Relations |
| Affects Version/s: | 1.2.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Maciej Hołyszko | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Environment: |
php 5.3/win, doctrine 1.2 svn, ATTR_QUOTE_IDENTIFIER = true, ATTR_USE_DQL_CALLBACKS = true |
||
| Attachments: |
|
| Description |
|
I find no way to define automatic orderBy in m2m relations with column not from reference table, but actual related table. E.g. BlogPost <= m2m through BlogPostCategory => BlogCategory class BlogPost extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('title', 'string', 128); $this->hasColumn('content', 'string'); } public function setUp() { $this->hasMany('BlogCategory as BlogCategories', array('local' => 'id_blog_post', 'foreign' => 'id_blog_category', 'refClass' => 'BlogPostCategory', 'orderBy' => 'name')); } } class BlogCategory extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('name', 'string', 128); } public function setUp() { $this->hasMany('BlogPost as BlogPosts', array('local' => 'id_blog_category', 'foreign' => 'id_blog_post', 'refClass' => 'BlogPostCategory')); } } class BlogPostCategory extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('id_blog_post', 'integer', null, array('primary' => true)); $this->hasColumn('id_blog_category', 'integer', null, array('primary' => true)); } public function setUp() { $this->hasOne('BlogPost', array('local' => 'id_blog_post', 'foreign' => 'id', 'onDelete' => 'CASCADE')); $this->hasOne('BlogCategory', array('local' => 'id_blog_category', 'foreign' => 'id', 'onDelete' => 'CASCADE')); } } The resulting query contains doubled 'name' column in ORDER BY clause, both from reference table and related table, e.g. ORDER BY t2.name, t3.name I tried putting the following code in BlogCategory::setTableDefinition() instead of attribute in relation definition in BlogPost record: $this->option('orderBy', 'name');
but the result was the same. Maybe I'm doing something wrong? Is there a possibility to define an alias, where to get column name from - in orderBy attribute? Thanks in advance. |
| Comments |
| Comment by Maciej Hołyszko [ 02/Dec/09 ] |
|
Attached test case. |
| Comment by Maciej Hołyszko [ 08/Dec/09 ] |
|
I find this issue as critical one now, because when I use e.g. $this->option('orderBy', 'name');
in a model's definition (not ref class), then when other model is related m2m with it, a query loading both of them with relations will fail because of name column duplicated in ref table. |
| Comment by suhock [ 23/Apr/10 ] |
|
I am having the same issue with an equivalent test case. For some reason, the 'orderBy' option on the target of the join (set by calling the option() function inside the setUp() method of the model class, not the ref class) is being applied to the relation table. After digging through the 1.2.2 tag a bit, I found altering line 1319 of Query.php as follows seems to fix the problem (at least against my test cases):
I'll do some more thorough testing and submit a patch if I find time. |
| Comment by Bart W [ 17/Feb/11 ] |
|
I had this issue as well. suhock's solution fixed it for me. It would be nice if this was merged in to a bug fix release of Doctrine 1.x. |
| Comment by suhock [ 18/Feb/11 ] |
|
I ended up creating a new ticket, DC-651, which addresses a more general problem with the orderBy feature. You should use the attached Ticket_DC651.patch instead, as I found the solution I provided here is not completely correct and does not pass all test cases. |
[DC-665] Named parameters doesn't work on MSSQL anymore Created: 05/May/10 Updated: 22/Sep/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Dennis Pettersson | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows Server 2003. PHP 5.2.12. MS SQL Server 2008 |
||
| Description |
|
After upgrading to Doctrine 1.2.2 queries with named arguments doesn't work anymore. I get the error If changing the query to |
| Comments |
| Comment by Dennis Pettersson [ 06/May/10 ] |
|
Should mention I upgraded from 1.1.6 to 1.2.2, so the problem might be present in earlier 1.2.x versions as well. |
[DC-627] Work on link-table and leftJoin Created: 13/Apr/10 Updated: 13/Apr/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Thomas Tourlourat - Armetiz | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows Seven - WAMP 2.0i |
||
| Attachments: |
|
| Description |
|
Looking at the attachment to see the little schema. The link-table items_children is here to create a many-to-many relationships between Items and Children. So, after configure the YAML and generated Models.
The SQL Output of the query is :
All array are order by something, in this case it's a natural order which come from the items_children order into database. Now, I want to apply a condition, or a filter on the items_children table.
Or something crazy :
But how can I do that with DQL ? Because I have no access to the Link-table. Link-Table are use to create many-to-many, that could be OOP array. So we have to be allowed to add "index" to order the result. Also, we have to be allowed to add condition on this tables, like "datePromote" or simply "enabled". The solution should be on the following DQL Query :
But the SQL Output is :
To conclude, it's a blocker problem. Because I can't use a standard DB schema. Regards, |
[DC-839] Version classes not built for models using package attribute Created: 24/Aug/10 Updated: 08/Mar/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Behaviors |
| Affects Version/s: | 1.2.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Prasad Gupte | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
PHP 5.2.3 / Symfony 1.4.6 |
||
| Description |
|
For models using the 'package' attribute in the schema definition, the version classes do not get created. However, the version table gets created. There is no problem during the build, but when loading fixtures, there is a fatal error: Class TaxCodeVersion not found TaxCode:
|
| Comments |
| Comment by hetsch [ 08/Mar/11 ] |
|
Same here, If i use this yaml file: Page: PageVersion and PageTranslation Models don't get generated if i use 'build-models-yaml'. Have to create the Models manually then it works fine. |
[DC-770] Result Cache Created: 29/Jun/10 Updated: 29/Jun/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Record |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Thomas Tourlourat - Armetiz | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Doctrine result cache isn't working properly. Here a simple example, when I'm calling query->execute (); parentProgram is related to a video. line 1014 : I have just add some code to output data. else { $result = $this->_constructQueryFromCache($cached); $oVideo = $result[0]; echo "cached "; var_dump (count ($oVideo->parentProgram->getReferences ())); exit (0); }[/code] The output of a query execution (the first with an empty APC cache) with "useResultCache" is :
The problem is coming from the serialize php function that can't serialize protected properties.. A solution could be use __sleep function, and a public property that contain all important protected data. |
[DC-932] Queries fail when a model contains underscore and we try to apply a limit Created: 19/Nov/10 Updated: 19/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Noel GUILBERT | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Doctrine 1.2, Symfony 1.4.6, MySQL, Postgresql |
||
| Description |
|
Actually, I've a dead simple schema.yml, with two tables: T_Media: name: string(25) J_Acl: I have some fixtures: J_Acl: And then, the DQL query I want to execute: "From T_Media m INNER JOIN m.J_Acl order by m.created_at limit 1" But if I run this query, for instance in CLI, I got an error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test_noel.t2__media' doesn't exist. Notes:
|
[DC-922] master-slave replication with i18n behavior Created: 10/Nov/10 Updated: 10/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Behaviors |
| Affects Version/s: | 1.2.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | husen mankada | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
php 5.3, doctrine 1.2, Symfony 1.4, mysql |
||
| Description |
|
I'm trying to use sfDoctrineMasterSlavePlugin for database replication with Symfony 1.4 and PHP 5.3. But facing problem while selecting I18n records and receiving "Unknown relation alias Translation" error. I've also tried same with implementation solution given in master-slave chapter of doctrine cookbook but no success. Is anyone facing same problem with sfDoctrineMasterSlavePlugin and i18n behavio? Is there any solution of the problem? |
[DC-857] postHydrate not called for One to One relations, when ATTR_HYDRATE_OVERWRITE == false, and the record is cached in the table's identityMap Created: 03/Sep/10 Updated: 05/Sep/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Record |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Ben Davies | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
All |
||
| Attachments: |
|
| Description |
|
When objects are hydrated with a join to a one to one relation, if the queried object is stored in the table's cache, and ATTR_HYDRATE_OVERWRITE set to false, then the one to one relation's postHydrate method will never be called. This is due to this line. } else if ( ! isset($prev[$parent][$relationAlias])) { ...which will always evaluate to false, and postHydrate will ever be called, as the record has been pulled from the table cache here |
| Comments |
| Comment by Ben Davies [ 03/Sep/10 ] |
|
Test case attached. |
| Comment by Ben Davies [ 03/Sep/10 ] |
|
There needs to be some kind of caching on the pre/postHydrate calls, which is done throughout the Doctrine_Hydrator_Graph, except for when the relation is one-to-one. Unfortunately, I couldn't work out how to implement it for one-to-one. |
| Comment by Ben Davies [ 03/Sep/10 ] |
|
Correct Test Case |
| Comment by Ben Davies [ 03/Sep/10 ] |
|
Correct Test Case |
| Comment by Ben Davies [ 05/Sep/10 ] |
|
I was probably a little too tired to think this through clearly on a Friday after a long weeks work! |
[DC-1009] save() also updates fields which should not be Created: 08/Jun/11 Updated: 08/Jun/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Yan Urquiza | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows server 2003 PHP 5.2.17 / XP PRO 32bits XAMPP PHP 5.3.5 |
||
| Attachments: |
|
| Description |
|
When I want to do a simple update like this : $batches = ExamResultsBatchTable::getInstance()->retrieveByExamBatchStatus(ExamResultsBatch::valid_status_code); If I run this: here is the simpliest case. The same problems are signaled on other tables in the database, but different tables can be impacted by one save() (the execute() query still works fine). Example : 2 foreign tables will be updated , even if the save() action should only concern the main table, and one field (which is not a foreign key). Because save() is used in a lot of different places in our app, I need to find a solution to fix save(), or if not possible to override it to run a execute()like query. Thanks for your help. Yan |
[DC-978] Doctrine_Connection_Mssql dies on modifyLimitSubquery every time Created: 27/Feb/11 Updated: 27/Feb/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Connection |
| Affects Version/s: | 1.2.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Andrej Pavlovic | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
windows |
||
| Description |
|
Looking at the latest version of Doctrine_Connection_Mssql in git repo: In Doctrine_Query:getLimitSubquery() there is a call to Doctrine_Connection_Mssql::modifyLimitSubquery(). public function modifyLimitSubquery(Doctrine_Table $rootTable, $query, $limit = false, $offset = false, $isManip = false) { return $this->modifyLimitQuery($query, $limit, $offset, $isManip, true); } This in turn calls Doctrine_Connection_Mssql::modifyLimitQuery() wihtout passing the $queryOrigin parameter: public function modifyLimitQuery($query, $limit = false, $offset = false, $isManip = false, $isSubQuery = false, Doctrine_Query $queryOrigin = null) { if ($limit === false || !($limit > 0)) { return $query; } $orderby = stristr($query, 'ORDER BY'); if ($offset !== false && $orderby === false) { throw new Doctrine_Connection_Exception("OFFSET cannot be used in MSSQL without ORDER BY due to emulation reasons."); } $count = intval($limit); $offset = intval($offset); if ($offset < 0) { throw new Doctrine_Connection_Exception("LIMIT argument offset=$offset is not valid"); } $orderbySql = $queryOrigin->getSqlQueryPart('orderby'); $orderbyDql = $queryOrigin->getDqlPart('orderby'); if ($orderby !== false) { $orders = $this->parseOrderBy(implode(', ', $queryOrigin->getDqlPart('orderby'))); for ($i = 0; $i < count($orders); $i++) { ... From just looking at the above code, the query chokes on the first call to a $queryOrigin method. It seems like there is a lot of missing code here which should work with the $query directly when $queryOrigin is not available... What is the point of $orderbySql and $orderbyDql variables when they are not used anywhere? This code looks like it's half way done and untested. |
[DC-963] Doctrine cache - Salt dissociation Created: 03/Feb/11 Updated: 18/Apr/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Caching |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Critical |
| Reporter: | Thomas Tourlourat - Armetiz | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
Doctrine Cache store data into a persistence storage. Regarding APC, Doctrine use a share storage. I'm using a server to host two Doctrine project, a preproduction & production Website. In some case, DQL is the same on both project, but the data model definition isn't. Preproduction convert DQL to SQL using data model definition, and store the SQL result into APC cache refer to the DQL hash. I'm not sure about the quality of this explanation... But I can add some information is needed. The solution of this problem is easy. Just add a SALT to any cache id's. It's a Doctrine_Cache problem, not only a Doctrine_Cache_APC problem.. $cacheDriver = new doctrine_Cache_Apc (); |
| Comments |
| Comment by Thomas Tourlourat - Armetiz [ 03/Feb/11 ] |
|
to complete this bug, I think it's also a problem on DC 2.. |
| Comment by Jaik Dean [ 18/Apr/11 ] |
|
There is already an (undocumented?) option "prefix" that allows this. $cacheDriver = new Doctrine_Cache_Apc(array('prefix' => 'MY UNIQUE SALT')); |
[DC-1058] Warning: Invalid argument supplied for foreach() in SqlWalker.php line 899 Created: 29/Jul/12 Updated: 29/Jul/12 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Alexander Cucer | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | paginator | ||
| Environment: |
Linux, Ubuntu 12, php 5.4 |
||
| Description |
|
Hallo, i get the error Here is the line Here are the relations and the query Here is the dump of $assoc before warning array(16) { ["orphanRemoval"]=> |
[DC-980] Moving all ALTERS queries to the end of generated sql file (task build-sql) Created: 04/Mar/11 Updated: 04/Mar/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Cli, Schema Files |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Critical |
| Reporter: | Sergey Eremenko | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Actual in case of using multi database configuration and foreign keys between them. Now build-sql task generates SQL query for database by database in alphabetical order. It's ugly when we have multidatabase configuration and foreign keys between their tables. It's impossible to do 'import-sql' without errors beucase foreign keys constrains to nonexisting tables are in next database in order. I have added some code to strings 1176-... |
[DC-1053] Renaming a doctrine 'string' field may result in loss of data as the field's type changes. (MySQL) Created: 26/Mar/12 Updated: 26/Mar/12 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Migrations |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Ben Lancaster | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PHP 5.3.5-1ubuntu7.2ppa1~lucid with Suhosin-Patch (cli) (built: May 7 2011 03:12:27) |
||
| Description |
|
Consider the following schema: schema.yml MyTable:
columns:
some_text: string
Doctrine creates the table with: CREATE TABLE `my_table` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `some_text` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; Now, the following migration should rename the field from some_text to just_text: <?php class Version1 extends Doctrine_Migration_Base { public function up() { $this->renameColumn('my_table', 'some_text', 'just_text'); } public function down() { $this->renameColumn('my_table', 'just_text', 'some_text'); } } ...however the field gets renamed and the type becomes VARCHAR(255), as the resulting SHOW CREATE TABLE my_table shows: CREATE TABLE `my_table` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `a_varchar` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; Causes data in the column greater than 255 bytes to get truncated |
[DC-1052] limit() get lost on multiple joins Created: 20/Mar/12 Updated: 20/Mar/12 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Michael Kempf | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
$strSql = UserFeedTable::getInstance() string(1075) "SELECT u.id AS u_id, u.name AS uname, u.image AS uimage, u.lead AS ulead, u.headline AS uheadline, u.sort AS usort, u.is_active AS uis_active, u.is_favorite AS uis_favorite, u.feed_id AS ufeed_id, u.profile_id AS uprofile_id, u.category_id AS ucategory_id, u.created_at AS ucreated_at, u.updated_at AS uupdated_at, f.id AS fid, f.url AS furl, f.name AS fname, f.created_at AS fcreated_at, f.updated_at AS fupdated_at, f2.id AS f2id, f2.lead AS f2lead, f2.description AS f2description, f2.image AS f2image, f2.pub_date AS f2pub_date, f2.link AS f2link, f2.feed_id AS f2feed_id, f2.created_at AS f2created_at, f2.updated_at AS f2updated_at, f3.id AS f3id, f3.profile_id AS f3profile_id, f3.feed_item_id AS f3feed_item_id, f3.created_at AS f3created_at, f3.updated_at AS f3_updated_at FROM user_feed u LEFT JOIN feed f ON u.feed_id = f.id LEFT JOIN feed_item f2 ON f.id = f2.feed_id LEFT JOIN favorite f3 ON f2.id = f3.feed_item_id WHERE u.id IN ('7', '8', '9', '10', '11') AND (u.profile_id = ? AND u.is_active = ?)" As you can see, the limit is missing. |
[DC-371] Lazy loading - doctrine makes extra queries into db Created: 19/Dec/09 Updated: 23/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Behaviors, Documentation, Query, Record |
| Affects Version/s: | 1.2.0-BETA3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Roman Drapeko | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Symfony 1.4, Doctrine Version: 1.2.0-BETA3 |
||
| Description |
|
Just downloaded symfony 1.4 First of all I have a query: $q = \Doctrine_Query::create() After that I'm accessing the fields of this object: $userArray = array( This is the actual queries into DB: NR1: NR2: As you can see there are TWO queries however there should be only one query. The problem is that u.user_real_id is NULL in database and when I do 'real_user_details_id' => $this->getUser()->getRealUserDetailsId() doctrine does not have enough intelligence to understand that these fields have been already requested in NR1. If I comment this field, everything works well. SURPRISE! As you understand this a very critical bug and of course our system won't go to production with this bug. P.S. Is it possible to turn off the lazy loading in doctrine? |
| Comments |
| Comment by Roman Drapeko [ 17/Jan/10 ] |
|
Any comments? Will it be fixed?? |
| Comment by Jonathan H. Wage [ 01/Mar/10 ] |
|
Hi, I'd like to take a look but can you make a failing test case that I can run so that I can see if I can come up with a patch that fixes your case and doesn't break anything else. |
| Comment by Luke Winiarski [ 01/Jun/10 ] |
|
Hi I had similar problem but after several hours i did work it out Try to make get method in your model for getting field which has NULL value in database public function getUserRealId() { return $this->_get("user_real_id", false); }by making second argument false u force doctrine not to lazy load value and extra sql query is not created regards |
| Comment by Jonathan H. Wage [ 08/Jun/10 ] |
|
Has anyone been able to reproduce this in a test case? I am not having much luck so far. |
| Comment by Gennady Feldman [ 23/Dec/10 ] |
|
I've seen this a ton of times. Basically when it loads related records through the Hydrator using leftJoin() and gets NULLs back. BUT it doesn't save the fact that the related records are NULL. So when you actually do call to getRelated objects it sees that it doesn't have the value cached and runs the query again. Let me know if I should show you the problem in the Doctrine code base. |
[DC-347] AddPendingJoinConditions doesn't work if alias equals model name Created: 09/Dec/09 Updated: 29/Jan/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Christian Jaentsch | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
If the alias in a from-query is equal to the model name, I get an exception when executing the query after adding a "pendingJoinCondition". See attached testCase. |
| Comments |
| Comment by David Abdemoulaie [ 29/Jan/10 ] |
|
I fail to see why you would use an alias that is equal to the model name. |
| Comment by Christian Jaentsch [ 29/Jan/10 ] |
|
To clarify again: Using an alias equal to the model name is the same as not using an alias at all. The built sql is the same afterwards (and the addPendingJoinCondition behaviour is the same as well). I would not use an alias equal to the model name myself, but sometimes this is used in Doctrine core, e.g. in Doctrine_Relation_ForeignKey around line 60. So to solve the problem either all the core queries, where no alias or an alias equal to the model name is used, have to be rewritten or the behaviour of a respective query has to be changed somehow so that applying an addPendingJoinCondition is possible even in the given case. |
[DC-690] Wrong data type for oracle integer Created: 18/May/10 Updated: 08/Jun/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Arian Maykon de Araújo Diógenes | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Trying to migrate from doctrine 1 to 1.2 and this problem came up to me, i cant map a column to integer(7) (which should create a number(7) column) using Oracle, he always create a NUMBER(20) field. Taking a look at Doctrine_DataDict_Oracle i realize the problem is here. |
| Comments |
| Comment by Jonathan H. Wage [ 08/Jun/10 ] |
|
We made a bunch of changes/fixes related to oracle. This was to fix another bug I believe. I can't remember the user that is responsible for these changes. Does anyone else remember or know anything? |
[DC-659] Sluggable behavior does not check uniqueness on insert if a slug is manually set, causing SQL error/crash Created: 01/May/10 Updated: 05/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Behaviors |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Critical |
| Reporter: | Christian Seaman | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
symfony-1.3.4 and doctrine-1.2.2 |
||
| Description |
|
The Sluggable behavior has the following code:
Sluggable.php /**
* Set the slug value automatically when a record is inserted
*
* @param Doctrine_Event $event
* @return void
*/
public function preInsert(Doctrine_Event $event)
{
$record = $event->getInvoker();
$name = $record->getTable()->getFieldName($this->_options['name']);
if ( ! $record->$name) {
$record->$name = $this->buildSlugFromFields($record);
}
}
However, this can lead to problems... If the user incorrectly assigns a duplicate slug to the record then there is no uniqueness checking in doctrine and you get an uncaught SQL error looking something like this: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'my-slug-en_GB' for key 'foo_i18n_sluggable_idx' If this kind of "don't do a preInsert check if I manunally set the slug" behavior is a FEATURE then it would be best to have an option to allow it to be disabled. If it is a BUG then I would suggest that the preInsert method should be changed to: Sluggable.php /**
* Set the slug value automatically when a record is inserted
*
* @param Doctrine_Event $event
* @return void
*/
public function preInsert(Doctrine_Event $event)
{
$record = $event->getInvoker();
$name = $record->getTable()->getFieldName($this->_options['name']);
if ( ! $record->$name) {
$record->$name = $this->buildSlugFromFields($record);
} else { // Still check for slug uniqueness when you insert
$record->$name = $this->buildSlugFromSlugField($record);
}
}
C |
| Comments |
| Comment by Jonathan H. Wage [ 08/Jun/10 ] |
|
Can you provide your changes as a patch/diff with a test case? |
| Comment by Christian Seaman [ 05/Oct/10 ] |
|
Hi Jonathan, I'm not so hot at making patches or test cases, but it should be fairly easy if you know what you're doing... Just try to create and save two records with the same hard-coded slug and the second one will fail with an ugly MySQL crash. If you add the lines } else { // Still check for slug uniqueness when you insert
$record->$name = $this->buildSlugFromSlugField($record);
to the Sluggable::preInsert() method then this problem is averted and the test cases will pass. I have been running with this modification in our production version of Doctrine since I first reported this in May and it all seems to work well. If you really need me to figure out how to make a patch and test case please re-comment on this ticket and I'll see what I can do when I have some free time. C |
[DC-644] _getCacheKeys() exhausts memory Created: 22/Apr/10 Updated: 06/Jul/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Caching |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Amir W | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Doctrine is installed as a Symfony plugin. Using the latest Symfony from SVN. |
||
| Description |
|
My scripts have excessive memory consumption and I've often saw in my logs: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 2097152 bytes) in /proj/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Cache/Apc.php on line 111 Looking into the code I've found which function to blame:
My server extensively uses APC caching and it's normal to have many cache keys. Is there another way to avoid this pitfall? |
| Comments |
| Comment by Amir W [ 26/Apr/10 ] |
|
Is there any patch that could be provided meanwhile? This is quite a problem on a live website. |
| Comment by Amir W [ 10/May/10 ] |
|
Is this not a critical issue for Doctrine's cache? It's been up for 2 weeks with not even a comment... |
| Comment by Jonathan H. Wage [ 10/May/10 ] |
|
Hi, what are you calling that is invoking _getCacheKeys()? The only methods that call it are the deleteBy*() methods. It is expected that these methods have to get the entire list of cache keys from the driver in order to perform the delete by operation. These cache clearing operations should probably be done in the CLI environment where the memory limits are higher. If you want to avoid _getCacheKeys() being invoked, then you must not use the deleteBy*() methods. |
| Comment by Amir W [ 10/May/10 ] |
|
Thank you for commenting. Yes, I am using deleteByRegex() since I need to expire some result cache entries upon an update operation. What other choice do I have if I wish to keep using the result cache offered by Doctrine? Is there any other mechanism? Can't _getCacheKeys() be optimized some way? |
| Comment by Jonathan H. Wage [ 10/May/10 ] |
|
No, it is not able to be optimized anymore. It has to load all the keys into a php array in memory in order to loop over them to compare against the regex. You should probably not be doing cache clearing operations in the browser under apache. If you do, you'll need to raise your memory limit. |
| Comment by Amir W [ 10/May/10 ] |
|
My code actually had a few of these calls and I've now removed use of the result cache with Doctrine. What you're writing means the result cache is not usable for dynamic websites. IMHO, it's a good practice to cache results and remove them once an update is made to the data (which naturally can happen due to an update from a user). However, if that by itself creates an overload on the server (and as you know even a temporary memory abuse leads to an overload), I cannot see how it can be useful. Thanks |
| Comment by Jonathan H. Wage [ 10/May/10 ] |
|
This is the only way to allow more complex delete functionality. How you use it, is not up to us. We intended that cache clearing is done from the command line or in an environment where the memory limit is high enough to be able to load all those keys. It may not be able to be used by everyone, if it is not working for how you are using it then you will need to think of another solution I suppose. |
| Comment by Amir W [ 10/May/10 ] |
|
Thank you for your response and I'll think of another solution for my application. I did dive into the code and there's a relevant optimization that could be made. _getCacheKeys() is actually creating another array for all the cache keys which needlessly increases the memory used. There could be a way around the problem which also implements another feature I miss with the results cache. By allowing some sort of cache tagging to mark the items that may need to be deleted we could easily delete relevant entries. I'll describe the interface here. Instead of There should be We can then easily implement deletion of relevant result cache entries with deleteByTag('SomeTag') which would read 'Doctrine_Result_Cache_Tag_SomeTag' to figure out which entries should be removed from the cache. I'm pretty sure my usage scenario is not marginal but let me know what you think. |
| Comment by Jonathan H. Wage [ 10/May/10 ] |
|
This is already possible if I understand what you describe. $q->useResultCache(true, 3600, 'key_to_store_cache_under');
Now you can do: $cacheDriver->delete('key_to_store_cache_under');
Also what you describe useTagResultCache() and keeping up with our own list of cache keys is the way it used to be and was changed to this after worse performance problems were discovered with that approach. |
| Comment by Amir W [ 10/May/10 ] |
|
Perhaps I've been misunderstood so I'll try explain from the start. In my system a few queries do relate to the same pieces of information. That information can be updated by a user and thus I would need to remove anywhere between 0 and 50 related result cache variables. I cannot easily name each and every one of my queries thus giving a specific key name doesn't help. So what I did was to prefix the name of each of the queries to indicate that I'll know how to remove them. I may have thousands of results cached and would need to clear just a few. That's why I use the deleteBy*() which proves to be extremely inefficient as it retrieves ALL the keys in my cache driver and not only the Doctrine related ones. I really don't know how it has been implemented before but what I suggest wouldn't hurt performance as tagging would be an optional addition managed with another variable. If you think that won't b useful to other Doctrine users, I'll simply implement it for my system. Thanks |
| Comment by Jonathan H. Wage [ 10/May/10 ] |
|
I think the best solution is the one you suggested earlier. That each cache driver should directly implement this functionality and bypass the creation of the array. What do you think? It is backwards compatible so that way we can commit it in 1.2. |
| Comment by Amir W [ 10/May/10 ] |
|
Bypassing the array is a required optimization which is easy to implement but it's not really a solution to the problem I'm facing and I believe is common enough (Zend_Cache for example implements tagging) and need to be offered. As it'll be 2 new functions that will implement tagging only when specifically requested, it'll also be backward compatible. The only thing I'm not sure about is if an implementation of some locking mechanism would be needed for the cached variable which would hold the list of cache keys for a specific tag. |
| Comment by Jonathan H. Wage [ 10/May/10 ] |
|
Let me know what you come up with and we'll have a look at including it in the next 1.2.x release. |
| Comment by Amir W [ 16/May/10 ] |
|
Bypassing the extra array is still not good enough and IMHO the whole idea of deleteBy() should NOT be used if many such requests could be made, as is my case. What I've done now is what I mentioned before with a patch that is quite ugly. In Doctrine/Query/Abstract.php right after the line $cacheDriver->save($hash, $cached, $this->getResultCacheLifeSpan());
I've added if (!empty($GLOBALS['rcache_users_in_query'])) {
MyCache::keepRelatedCacheKey($GLOBALS['rcache_users_in_query'], $hash);
}
Which saves another cache key which holds the hash tags that would have to be deleted on an update. When a user on my system does the update, I then delete all relevant Doctrine keys with something like if (is_null($cacheDriver)) $cacheDriver = Doctrine_Manager::getInstance()->getAttribute(Doctrine_Core::ATTR_RESULT_CACHE);
foreach($arKeys as $key) {
$cacheDriver->delete($key);
}
and then delete my other cache key. This solution works well for me. Sorry I cannot make a nice Doctrine patch for it as I'm not well versed with your code. I still believe it should be supported by Doctrine with an optional extra parameter for $q->useResultCache() Thanks |
| Comment by David Abdemoulaie [ 08/Jun/10 ] |
|
Hi Amir, Zend_Cache does not implement tagging for either APC or Memcached backends, see the documentation. It also likely never will, all requests for this functionality have been closed with Wont Fix. I don't think the deleteBy methods should have ever been implemented. When initially implemented they cached a "doctrine_cache_keys" variable to store the keys known to Doctrine. This however led to a crippling bug that would crash my production servers after a few hours. Not even a friendly "out of memory" limit, but a slowdown and eventual crash. Please see DDC-460 for details. Note that I don't use the magic delete methods, just simple saves with timeouts and this was affecting me. I fixed the solution as you've seen using the _getCacheKeys() method. I don't believe this functionality should have ever been added to Doctrine to begin with, but this is what we have to work with. It should be the responsibility of the cache store to handle tagging and such, not poorly hacked on with application code. As it stands, the current implementation doesn't affect people who aren't even using this functionality, as it should be. As Jon suggested, you shouldn't be using this in the context of a page request. Use a CLI script or work on another solution. Your idea of tracking your keys in application code is a good idea, but it doesn't belong in Doctrine imo. |
| Comment by Amir W [ 10/Jun/10 ] |
|
Thanks David for your comment. I agree with you that my implementation should not belong in Doctrine and that tagging should have been a part of the cache backends. Continuing with the same logic you've presented, deleteBy...() functionality **should be removed** from Doctrine if it causes the system to crash as it does so in an obnoxious way so that it would take too long for most developers to notice this is where the problem lies. It has certainly taken too much of my time and efforts and I'd rather save the pain from others. |
| Comment by Carsten Henkelmann [ 06/Jul/11 ] |
|
We had the exact same problem. We used a "deleteAll()" of a ApcCache object and ran into the "allowed memory size exhausted" pitfall. We helped ourselves with a new class that extends ApcCache and uses the simpler apc_clear_cache function.
namespace Foo\Cache;
class ApcCache extends \Doctrine\Common\Cache\ApcCache
{
/**
* Delete all cache entries. Memory saving version...
*
* @return bool
*/
public function deleteAll()
{
return apc_clear_cache('user');
}
}
use Foo\Cache\ApcCache as Apc; ... $this->_apc = new Apc(); $this->_apc->deleteAll(); This doesn't return the ids of the deleted entries like the original function but we don't need that. So this works fine for us. |
[DC-586] Doctrine outputs invalid SQL when using Limit and Order By conditions in MSSQL Created: 18/Mar/10 Updated: 18/Mar/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Connection |
| Affects Version/s: | 1.2.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Jose Prado | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows XP |
||
| Description |
|
I have a Doctrine model which connects to a MSSQL database. I was trying to run the following query: $q = Doctrine_Query::create()
->select('*')
->from('Comment c')
->innerJoin('c.RecordType')
->innerJoin('c.Department')
->limit(10)
->orderBy('c.Counter');
The code failed with a SQL Syntax exception so I took a look at the generated query and found the following (SELECT fields shortened for readabilty): SELECT * FROM ( SELECT TOP 10 * FROM ( SELECT TOP 10 [c].[counter] AS [c__counter], [c].[loanid] AS [c__loanid]... ... ... FROM comments c INNER JOIN [SystemTypes] [s] ON [c].[recordtype] = [s].[code] AND [s].[fieldname] = 'RecordType' INNER JOIN [SystemTypes] [s2] ON [c].[department] = [s2].[code] AND [s2].[fieldname] = 'Department' ORDER BY [c].[counter] ) AS [inner_tbl] ORDER BY [inner_tbl].[counter] AS [c__counter] DESC ) AS [outer_tbl] ORDER BY [outer_tbl].[counter] AS [c__counter] ASC As you can see, the ORDER BY clauses on the inner_tbl and outer_tbl segments have AS clauses which do not belong there. If you fix the ORDER BY statements the query runs just fine. So I decided to prod around the Mssql.php connection class and found the following: 140 public function modifyLimitQuery($query, $limit = false, $offset = false, $isManip = false, $isSubQuery = false) 141 { ... 169 $field_array = explode(',', $fields_string); 170 $field_array = array_shift($field_array); 171 $aux2 = preg_split('/ as /', $field_array); 172 $aux2 = explode('.', end($aux2)); 173 174 $aliases[$i] = trim(end($aux2)); ... 232 } Line 171 seems to be in charge of setting up the orderBy aliases but it is looking for a lower case ' as ' string which doesn't exist in this SQL expression. Changing that to a case insensitive regular expression search seems to fix the problem: 171 $aux2 = preg_split('/ as /i', $field_array);
Here is the resulting SQL with the change: SELECT * FROM ( SELECT TOP 10 * FROM ( SELECT TOP 10 [c].[counter] AS [c__counter], [c].[loanid] AS [c__loanid]... ... ... FROM comments c INNER JOIN [SystemTypes] [s] ON [c].[recordtype] = [s].[code] AND [s].[fieldname] = 'RecordType' INNER JOIN [SystemTypes] [s2] ON [c].[department] = [s2].[code] AND [s2].[fieldname] = 'Department' ORDER BY [c].[counter] ) AS [inner_tbl] ORDER BY [inner_tbl].[c__counter] DESC ) AS [outer_tbl] ORDER BY [outer_tbl].[c__counter] ASC] This seems to fix the problem but I don't know if it'll create a regression. It's a start though. Anyone have any thoughts on this? |
[DC-515] HYDRATE_RECORD_HIERARCHY broken with many roots Created: 22/Feb/10 Updated: 09/Jun/10 |
|
| Status: | Reopened |
| Project: | Doctrine 1 |
| Component/s: | Nested Set |
| Affects Version/s: | 1.2.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Kamil Rojewski | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
DB schema: Category: Sample data: id: '1'
When using HYDRATE_RECORD_HIERARCHY, the first top-level category is empty. Everything is assigned to the other one. Only single-root trees work properly. |
| Comments |
| Comment by Kamil Rojewski [ 17/Mar/10 ] |
|
If you look at Doctrine_Collection::toHierarchy() you'll notice that there is NO reference to root_id, therefore it treats the entire collection as 1 tree (which is false). The bug is 100% repeatable. I've made a fast walkaround ba adding a multi-tree hydrator: class MultiRootHydrator extends Doctrine_Hydrator_RecordDriver { public function hydrateResultSet($stmt) { $result = parent::hydrateResultSet($stmt); $collection = array(); foreach ($result as $item) { if (!isset($collection[$item->root_id])) $collection[$item->root_id] = new Doctrine_Collection($result->getTable()); $collection[$item->root_id]->add($item); } $result = new Doctrine_Collection($result->getTable()); foreach ($collection as $tree) { $tree = $tree->toHierarchy(); $record = $tree->getFirst(); $result->add($record, $record->root_id); } return $result; } } It should clarify the problem. |
| Comment by Jonathan H. Wage [ 08/Jun/10 ] |
|
I think it was intended that you would only convert a single tree to a hierarchy. What would the structure of the returned data be like? |
| Comment by Kamil Rojewski [ 09/Jun/10 ] |
|
A Doctrine_Collection with root nodes seems to work fine. It allows to traverse the tree for each root. |
[DC-489] Doctrine_Record seems to have a bug with default values when updating Created: 10/Feb/10 Updated: 20/Jan/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Record |
| Affects Version/s: | 1.2.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Silver | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
PHP 5.2.11 |
||
| Description |
|
So lets see the table: User:
So lets say we have a user with `role` = 'support' and want to set em $user = new App_Model_User(); in debugger we see SQL query been made:
array(6) { ["id"]=> int(1) ["display_name"]=> string(13) "Administrator" ["username"]=> string(4) "root" ["password"]=> string(40) "45bb0f589525a2f0f2a48620bb59b1b8baef0c1d" ["role"]=> string(5) "admin" ["is_active"]=> bool(true) }Superb! Works as it should! So lets now set role of this user back to $user = new App_Model_User(); in debugger we didnot see any UPDATE queries! However object is been array(6) { ["id"]=> int(1) ["display_name"]=> string(13) "Administrator" ["username"]=> string(4) "root" ["password"]=> string(40) "45bb0f589525a2f0f2a48620bb59b1b8baef0c1d" ["role"]=> string(7) "support" ["is_active"]=> bool(true) }I cant overcome this problem right now, unfortunatelly (well I can However if I use Doctrine_Query of even $user = Doctrine_Core::getTable('App_Model_User')->find(1); instead of $user = new App_Model_User(); updates works well... |
| Comments |
| Comment by Petr Peller [ 20/Jan/11 ] |
|
I second this. When you UPDATE row with save() method of Record after setting identifier by assignIdentifier() doctrine removes columns updates from SQL which are set to default values same as it would do with INSERT. Other columns are updated correctly. This is sure a bug. You can workaround this by setting the value as NULL instead of the actual default value. (Which I wouldn't recommend). |
[DC-815] Model's default sorting breaks subqueries Created: 11/Aug/10 Updated: 14/Mar/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query, Record |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Jacek Jędrzejewski | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
It works except subqueries. Main table's order is added to subquery and vice versa. SQL query looks like this: {{ Query fails because there is >>no such column "t.id"<<. I include a testcase when it is all visible. BTW. there is nothing about that feature (and relation orderBy) in docs. It is only in UPGRADE file. |
| Comments |
| Comment by Jacek Jędrzejewski [ 25/Aug/10 ] |
|
Anyone? |
| Comment by Alan Betteridge [ 10/Mar/11 ] |
|
Am having the same issue! Eventually found the orderBy option on both the model and on relationships and was over joyed as I'd been trying to find a way of doing this, but it didn't work!! Found the patch http://www.doctrine-project.org/jira/browse/DC-651 which solved the first problem I encountered but now I'm getting this. |
| Comment by Alan Betteridge [ 14/Mar/11 ] |
|
Had a look at the code and tried only setting the orderBy if the current component is actually referenced in the from sql part of the query. Looking at what is selected from, $this->_sqlParts['from'], it appears that the main table ($map['table']->getTableName()) and $sqlAlias is include with a zero index and joined tables are keyed by their $alias (or at least the content of these variables within the loop). From this I believe I could detect if the current entry in the loop was from a table that was in the current "FROM" part of the query by looking for the table name and alias as an entry or the current alias as a key in the "FROM" array. Within my sub query the orderBy valeus would still get applied but only in the subquery and not in the main query where they were included before, out of scope. With patch DC-651 applied my code in Query.php at line 1315 noew looks as follows:
// Note: Only include orderBy values for tables we're actually selecting from (both the root table or
// tables referenced from it)
if (in_array("{$map['table']->getTableName()} {$sqlAlias}", $this->_sqlParts['from']) || array_key_exists($alias, $this->_sqlParts['from'])) {
if (isset($map['relation'])) {
if (isset($map['ref'])) {
$orderBy = $map['relation']['refTable']->processOrderBy($sqlAlias, $map['relation']['orderBy'], true);
if ($map['relation']['orderBy'] && $orderBy == $map['relation']['orderBy']) {
$orderBy = $map['relation']->getOrderByStatement($sqlAlias, true);
}
} else {
$orderBy = $map['relation']->getOrderByStatement($sqlAlias, true);
if ($orderBy == $map['relation']['orderBy']) {
$orderBy = null;
}
}
} else {
$orderBy = $map['table']->getOrderByStatement($sqlAlias, true);
}
} else {
$orderBy = null;
}
Am I correct in my assumptions? |
[DC-802] Alias in select and having Created: 28/Jul/10 Updated: 07/Aug/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Vasiliy Altunin | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows XP sp3 |
||
| Description |
|
i have query $q = Doctrine_Query::create() When it runs i have error: <b>Fatal error</b>: Uncaught exception SQL for it looks like: SELECT g.grid AS g_grid, g.fam AS gfam, g.nam AS g_nam, g.otc AS But i need Query looks like: SELECT g.grid AS g_grid, g.fam AS gfam, g.nam AS g_nam, g.otc AS This query run fine and give me what i need. Doctrine dont use 'md' alias instead it convert it to 'p__0' |
[DC-755] CLONE [DC-558] incorrect handling of MODEL_CLASS_PREFIX causes Doctrine_Migration_Diff to drop the whole database when working from YAML (Regression) Created: 20/Jun/10 Updated: 10/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Migrations |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Andrew Coulton | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Current HEAD of Doctrine 1.2 |
||
| Attachments: |
|
| Description |
|
Replicating the bug: Expected (previous) behaviour: Real behaviour: |
| Comments |
| Comment by Andrew Coulton [ 20/Jun/10 ] |
|
This seems to be a regression caused by the fix for While this fixed the issue when generating diff from models to YAML, it has now created the reverse issue for generating diffs from YAML to YAML - as the models generated for the "from" schema do not get MODEL_CLASS_PREFIX prepended and so now this command will drop all existing tables and recreate. I believe the fix may be to amend as: Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml $from = $this->_generateModels( Doctrine_Manager::getInstance()->getAttribute(Doctrine_Core::ATTR_MODEL_CLASS_PREFIX) . self::$_fromPrefix, $this->_from); $to = $this->_generateModels( Doctrine_Manager::getInstance()->getAttribute(Doctrine_Core::ATTR_MODEL_CLASS_PREFIX) . self::$_toPrefix, $this->_to ); Since it seems that when presented with a folder of models _generateModels ignores the prefix anyway. However, I'm not sure of other impacts possible as a result? |
| Comment by Andrew Coulton [ 29/Aug/10 ] |
|
I've been using and testing the modified version above locally for some time and it seems to work as expected. Any chance of this making it into core? Otherwise, the migrations feature is completely unusable when working YAML-YAML and using model prefixes on the newly released 1.2.3 |
| Comment by Jonathan H. Wage [ 29/Aug/10 ] |
|
Has anyone been able to produce this in a test case? |
| Comment by Andrew Coulton [ 30/Aug/10 ] |
|
I've attached a diff file with the DC755TestCase and the required from and to YAML schema files to reproduce this bug. I wasn't sure whether you prefer like this or as a git commit? |
| Comment by Andrew Coulton [ 30/Aug/10 ] |
|
Also attached a diff file of my proposed change to Doctrine_Migration_Diff to resolve this, but as I say unsure if it has implications on other migration types. |
| Comment by Andrew Coulton [ 10/Oct/10 ] |
[DC-747] Sequence name of build process is different to the one used in UnitOfWorks (based on DC521 with updated TestCase) Created: 17/Jun/10 Updated: 17/Jun/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | 1.2.3, 1.2.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Enrico Stahn | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
doctrine 1.2.4, symfony 1.4, snow leopard, php 5.3.1, postgresql 8.3 |
||
| Attachments: |
|
| Description |
|
I moved our project from doctrine 1.2.1 to 1.2.4. The build process stops because of this patch. We are using primary keys with an alias. It seems that the generation of the sequence name in the build-process is different to the one used in UnitOfWorks. Example: Authority: name: { type: string }This will generate a sequence called "authority_a_id", but it will try no "currval" the sequence "authority_id". I'll try to provide a UnitTest. The current seems broken. php -l Ticket/DC521TestCase.php Parse error: syntax error, unexpected $end, expecting T_FUNCTION in Ticket/DC521TestCase.php on line 143 |
| Comments |
| Comment by Enrico Stahn [ 17/Jun/10 ] |
|
Here is the test updated with the current ticket number. |
| Comment by Enrico Stahn [ 17/Jun/10 ] |
|
Updated. Now it should work/not work as expected. |
| Comment by Enrico Stahn [ 17/Jun/10 ] |
|
This isn't a blocker anymore because of the workaround i've found.
Example: Authority: name: { type: string } |
[DC-743] Incompatibilty between fixture import and accessors extends Created: 16/Jun/10 Updated: 22/Jul/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Data Fixtures, Import/Export |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Brice Favre | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
Window, PHP5, Symfony |
||
| Description |
|
Hello, I had a problem when i try to import data with an extended accessors when i try to insert a content with a relation. I discovered this problem in symfony. For example, here is my table :
News:
tableName: ne_news
columns:
id: { type: integer(4), primary: true, autoincrement: true }
author_id: { type: integer(4), notnull: true }
name: { type: string(255) }
description: { type: text }
relations:
author: { class: sfGuardUser, onDelete: NULL, local: author_id, foreign: id, foreignAlias: sfGuardUser }
And the fixture :
SfGuardUser:
sadmin:
username: admin
password: admin
is_super_admin: true
author1:
username: myname
News:
News1:
name: Test 1
description: Description of news 1
author: author1
I import it with symfony doctrine:data-load and it works. If i add a news.class.php and extends the autogenerated class it fails.
public function setAuthor($v)
{
//__log('extending setter');
return $this->_set('author', $v);
}
WhenDoctrine_Data_Import finds the setAuthor function, it wont transform author1 in object so $v will be a string, not an sfGuardUser object. What do you think? Is a common behavior, how can i extends my accessor? |
| Comments |
| Comment by ryan [ 22/Jul/11 ] |
|
this is the same issue as DC-735 |
[DC-735] Imported objects not converted to objects and parsed as string when a setter method exists Created: 14/Jun/10 Updated: 22/Jul/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Import/Export |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Kevin Dew | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Mac OS X 10.6 |
||
| Description |
|
If you set a setter method for a model which is for a relation the data import no longer works. This seems to be because in the _processRow method it checks if a method exists and then passes the default value rather than checking whether a relation exists first and passing the imported object. This effectively means you can't overload a setter method and still use the data import. |
| Comments |
| Comment by ryan [ 22/Jul/11 ] |
|
added testcase here |
[DC-725] Call record->get('RelationManyToManyName', FALSE) corrupt the record and generate a exception when calling record->save() Created: 09/Jun/10 Updated: 09/Jun/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Record |
| Affects Version/s: | 1.2.1, 1.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | David Jeanmonod | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
PHP 5.3.1 (cli) (built: Feb 11 2010 02:32:22) |
||
| Attachments: |
|
| Description |
|
Imagine a simple case. Contact can have many categories. $c = Doctrine::getTable('Contact')->findOneById($id);
$c->get('Categories', false);
$c->save();
Generate the following error PHP Fatal error: Call to a member function save() on a non-object in /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/UnitOfWork.php on line 443
PHP Stack trace:
PHP 1. {main}() /test/doctrine/get_with_no_load_corrupt_many_to_many_assoc_.php:0
PHP 2. Doctrine_Record->save() /test/doctrine/get_with_no_load_corrupt_many_to_many_assoc_.php:51
PHP 3. Doctrine_Connection_UnitOfWork->saveGraph() /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record.php:1705
PHP 4. Doctrine_Connection_UnitOfWork->saveAssociations() /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/UnitOfWork.php:137
|
| Comments |
| Comment by David Jeanmonod [ 09/Jun/10 ] |
|
Test case for the bug |
[DC-934] One-to-one relationship with cascading deletion and softdelete creates empty records Created: 21/Nov/10 Updated: 29/Nov/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Record |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Rich Sage | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Ubuntu 10.10, PHP 5.3.3 |
||
| Attachments: |
|
| Description |
|
When using softdelete behaviour with cascading deletion on a one-to-one relationship, Doctrine will create a 'child' record if it doesn't exist already, during the cascading deletion. Eg:
Result is:
Is this expected behaviour? I've attached a test case script, tested against export from SVN of Doctrine 1.2.3 that demonstrates this. |
| Comments |
| Comment by marius [ 29/Nov/11 ] |
|
I can confirm this issue on Ubuntu 11.10 PHP 5.3.6-13ubuntu3.2 |
[DC-936] json schema import broken Created: 22/Nov/10 Updated: 22/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | File Parser |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Mael Nison | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PHP 5.3.3-1ubuntu9.1 |
||
| Attachments: |
|
| Description |
|
With a valid Json file : It's due to this line, line, in Doctrine/Parser/Json.php (#65) : It should be: Because casting the result as array will only affect the top-level element. You must use the second parameter of json_decode() to force every objects (including sub-objects) to be converted to indexed arrays. |
| Comments |
| Comment by Mael Nison [ 22/Nov/10 ] |
|
A try to import this file should fail. |
| Comment by Brian Fenton [ 22/Dec/10 ] |
|
I've submitted a pull request w/patch and unit test for this issue using the fix above. I had the same problem in my code on OS X 10.6.4, PHP 5.3.2 |
[DC-935] Doctrine_Task_BuildAllReload does not call generate-models-from-yaml Created: 21/Nov/10 Updated: 21/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Cli |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Brandon Evans | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows Vista 32bit, Apache 2.2.14, PHP 5.3.1 |
||
| Attachments: |
|
| Description |
|
Doctrine_Task_BuildAllReload never calls generate models-from-yaml. This does not coincide with the logic of Doctrine_Task_BuildAll and Doctrine_Task_BuildAllLoad. BuildAllReload suggests that it will be building all (everything) and then reloading the database. Doctrine 1.2.3 - BuildAllReload.php public function __construct($dispatcher = null) { parent::__construct($dispatcher); $this->rebuildDb = new Doctrine_Task_RebuildDb($this->dispatcher); $this->loadData = new Doctrine_Task_LoadData($this->dispatcher); $this->requiredArguments = array_merge($this->requiredArguments, $this->rebuildDb->requiredArguments, $this->loadData->requiredArguments); $this->optionalArguments = array_merge($this->optionalArguments, $this->rebuildDb->optionalArguments, $this->loadData->optionalArguments); } public function execute() { $this->rebuildDb->setArguments($this->getArguments()); $this->rebuildDb->execute(); $this->loadData->setArguments($this->getArguments()); $this->loadData->execute(); } Instead, I think it would be more efficient and understanding to follow the same logic as build-all and build-all-load by calling drop-db and build-all-load. Proposed - BuildAllReload.php public function __construct($dispatcher = null) { parent::__construct($dispatcher); $this->dropDb = new Doctrine_Task_DropDb($this->dispatcher); $this->buildAllLoad = new Doctrine_Task_BuildAllLoad($this->dispatcher); $this->requiredArguments = array_merge($this->requiredArguments, $this->dropDb->requiredArguments, $this->buildAllLoad->requiredArguments); $this->optionalArguments = array_merge($this->optionalArguments, $this->dropDb->optionalArguments, $this->buildAllLoad->optionalArguments); } public function execute() { $this->dropDb->setArguments($this->getArguments()); $this->dropDb->execute(); $this->buildAllLoad->setArguments($this->getArguments()); $this->buildAllLoad->execute(); } I attached a patch with the above changes... I got a little lost in the test area for Doctrine_CLI, so that is not included = ) |
| Comments |
| Comment by Brandon Evans [ 21/Nov/10 ] |
|
Added the proper proposed code this time and also attached patch with better naming. |
[DC-931] Newly generated Migration Classes failing to load due to method used to determine class name Created: 19/Nov/10 Updated: 19/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Migrations |
| Affects Version/s: | 1.2.0-ALPHA1, 1.2.0-ALPHA2, 1.2.0-ALPHA3, 1.2.0-BETA1, 1.2.0-BETA2, 1.2.0-BETA3, 1.2.0-RC1, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Adam Benson | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
LAMP |
||
| Description |
|
The loadMigrationClassesFromDirectory() method in Doctrine_Migration uses array_diff on get_declared_classes() between including each classes script. When a new migration class is generated by Doctrine_Core::generateMigrationsFromDiff it's class is loaded, which means loadMigrationClassesFromDirectory silently fails to load the newly generated migration on the same request. This means that scripts that first generate migrations and then apply them must be executed twice - first to generate then to apply. The following example code is used to check if the database has been modifed, generate migrations between the base version and the latest models, and then migrate the database if needed: automigrate.php Doctrine_Core::generateYamlFromModels(ROOT_PATH.'tmp/yaml/', ROOT_PATH.'models/'); $result = Doctrine_Core::generateMigrationsFromDiff(ROOT_PATH.'tmp/migrations/', ROOT_PATH.'data/yaml/', ROOT_PATH.'tmp/yaml/'); unlink(ROOT_PATH.'data/yaml/schema.yml'); rename(ROOT_PATH.'tmp/yaml/schema.yml', ROOT_PATH.'data/yaml/schema.yml'); $migration = new Doctrine_Migration(ROOT_PATH.'tmp/migrations'); $currentVersion = $migration->getCurrentVersion(); $latestVersion = $migration->getLatestVersion(); if ($currentVersion < $latestVersion) { $migration->migrate(); $this->app->addMessage("Database migration completed (from version $currentVersion to version $latestVersion)","success"); } else { $this->app->addMessage("Database is up to date and doesn't require migration (at version $currentVersion)","success"); } |
[DC-929] createIndexSql and dropIndexSql don't use the same logic to get the index name Created: 16/Nov/10 Updated: 07/Sep/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Migrations |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Lea Haensenberger | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Postgresql 8.4, Symfony 1.4, Doctrine 1.2 |
||
| Description |
|
In the class Doctrine_Export the functions for creating and dropping indexes do not use the same logic to get the name of the index to be created or dropped. |
| Comments |
| Comment by Lukas Kahwe [ 16/Nov/10 ] |
|
looks to me like this is a bug in index creation. then again fixing the bug will lead to potential BC issues. that being said, anyone affected could "simply" set the index format to empty. also "fixing" the names to the proper format does not require shuffeling around data. so imho the right fix would be to apply the drop naming logic in the create logic. what surprises me is that the main reason for appending _idx by default was that many RDBMS will otherwise break because they do not separate identifiers between constraints and indexes etc and therefore people run into collisions without the postfix. |
| Comment by John Kary [ 07/Sep/11 ] |
[DC-930] Complex query with DISTINCT and LIMIT on pgsql causes a SQLSTATE exception - problem in doctrine_subquery_alias Created: 16/Nov/10 Updated: 16/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Jacek Dębowczyk | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
pgsql |
||
| Description |
|
There is a problem in the following code in Doctrine/Query.php (lines 1257-1279) inside the buildSqlQuery() method: $subquery = $this->getLimitSubquery(); // what about composite keys? $idColumnName = $table->getColumnName($table->getIdentifier()); switch (strtolower($this->_conn->getDriverName())) { case 'mysql': [...] case 'pgsql': $subqueryAlias = $this->_conn->quoteIdentifier('doctrine_subquery_alias'); // pgsql needs special nested LIMIT subquery $subquery = 'SELECT ' . $subqueryAlias . '.' . $this->_conn->quoteIdentifier($idColumnName) . ' FROM (' . $subquery . ') AS ' . $subqueryAlias; break; } The above code is executed when a query consist of DISTINCT and LIMIT clauses. The most common situation is using pager. SELECT doctrine_subquery_alias.id FROM ((SELECT DISTINCT d1.id, d2.id FROM ...)) AS doctrine_subquery_alias It, of course, causes the "ambiguous column name" pgsql exception. |
[DC-928] [Migrations] Drop not null is not working in Postgres Created: 16/Nov/10 Updated: 16/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Migrations |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Lea Haensenberger | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Postgresql 8.4, Symfony 1.4, Doctrine 1.2 |
||
| Attachments: |
|
| Description |
|
When removing the not null from a column the migration does not change anything in the database. This is due to the following check on line 162 of lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Export/Pgsql.php So if notnull is not there or set to false or '0' or 0 the code does not enter into that if statement and therefore no changes are done to the not null value of the column. |
| Comments |
| Comment by Lukas Kahwe [ 16/Nov/10 ] |
|
@Lea: can you write up a patch for this? would also be nice if you could check if the same issue affects other drivers. |
| Comment by Lea Haensenberger [ 16/Nov/10 ] |
|
Here is a patch (attachment). The generate-migrations-diff Task in Symfony sets 'notnull' to an empty string if it's false in the schema.yml, therefore the check for empty string. I had a quick look at the classes for other DBs, but that seems to be a postgres only issue. |
[DC-927] Query with left join and group clause returns only one row, even though there are multiple results Created: 14/Nov/10 Updated: 19/May/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Bart van den Burg | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | None | ||
| Environment: |
Windows 7-64 bit |
||
| Description |
|
under certain circumstances, Doctrine will only return one result out of a bunch of results, for example: $ symfony doctrine:dql "from Tafel t, t.Reservering r where t.restaurant_id=4 select date(t.tijd), count(t.id) tafels, count(r.id) reserveringen group by date(t.tijd)" Expected outcome: The query works fine without the left join: |
| Comments |
| Comment by Bart van den Burg [ 14/Nov/10 ] |
|
As you can see, by the way, it does actually say "found 2 results", but then returns only one. |
| Comment by Willem van Duijn [ 08/Feb/11 ] |
|
There are multiple reports from people that are hurt by this bug: http://www.devcomments.com/doctrine-execute-only-returns-one-row-to286270.htm Setting the Hydration-mode to HYDRATE_NONE yields multiple result rows (but is not useful). |
| Comment by Victor Ruiz [ 18/Feb/11 ] |
|
Related in some way with multiple order by clauses. If I remove all of them but one it works, the problem appears when I put more than one order by criteria. |
| Comment by Mike Seth [ 19/May/11 ] |
|
This is a hydration problem that occurs because the ID columns of the joined tables are not SELECT'ed explicitly. The offending code is a loop in the graph base hydrator, but I don't understand it well enough to fix it with any certainty that I don't break anything. |
[DC-925] missing hasOne() method-call in many-to-many relation Created: 11/Nov/10 Updated: 11/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Relations |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Simon Schick | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Debian Lenny |
||
| Description |
|
Here's my YAML-file for the model: http://pastie.org/1290649 I'm using the following command to build the whole model: symfony doctrine:build --all --and-load Please have a closer look at the class BaseTicketHasHardware: http://pastie.org/1290737 |
[DC-920] The ability to add sql in the query between the first word and body of the query (allowing "SELECT STRAIGHT_JOIN" etc) Created: 09/Nov/10 Updated: 09/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major |
| Reporter: | will ferrer | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
XP XAMP |
||
| Description |
|
I recently discovered that I could greatly optimize some of the queries that were being run through our system by adding a STRAIGHT_JOIN keyword to the front of the select I added a feature to doctrine which allows me to inject sql into the query in the right place to enable features such as "STRAIGHT_JOIN" but I can't post the patch because my patches are starting to run together – the syntax with in the generated patch would also contain parts of other patches I have posted to jira but have not yet been included in the doctrine svn. I still wanted to make this post because it will give me a ticket number to base my test cases around. Will Ferrer |
| Comments |
| Comment by will ferrer [ 09/Nov/10 ] |
|
In order to show what this patch fixes I am including my test case for the patch below: <?php /* * $Id$ * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * and is licensed under the LGPL. For more information, see * <http://www.doctrine-project.org>. */ /** * Doctrine_Ticket_DC920_TestCase * * @package Doctrine * @author Will Ferrer * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @category Object Relational Mapping * @link www.doctrine-project.org * @since 1.0 * @version $Revision$ */ class Doctrine_Ticket_DC920_TestCase extends Doctrine_UnitTestCase { public function testBeforeBodySelect() { $q = new Doctrine_Query(); $q->parseDqlQuery("SELECT DISTINCT STRAIGHT_JOIN u.name, p.id FROM User u LEFT JOIN u.Phonenumber p ON p.phonenumber = '123 123'"); $this->assertEqual($q->getSqlQuery(), "SELECT DISTINCT STRAIGHT_JOIN e.id AS e__id, e.name AS e__name, p.id AS p__id FROM entity e LEFT JOIN phonenumber p ON (p.phonenumber = '123 123') WHERE (e.type = 0)"); $this->assertEqual($q->getDql(), "SELECT DISTINCT STRAIGHT_JOIN u.name, p.id FROM User u LEFT JOIN u.Phonenumber p ON p.phonenumber = '123 123'"); } public function testBeforeBodySelectNoneDQL() { $q = new Doctrine_Query(); $q->select("DISTINCT STRAIGHT_JOIN u.name, p.id"); $q->from('User u'); $q->leftJoin("u.Phonenumber p ON (p.phonenumber = '123 123')"); $this->assertEqual($q->getSqlQuery(), "SELECT DISTINCT STRAIGHT_JOIN e.id AS e__id, e.name AS e__name, p.id AS p__id FROM entity e LEFT JOIN phonenumber p ON (p.phonenumber = '123 123') WHERE (e.type = 0)"); $this->assertEqual($q->getDql(), "SELECT DISTINCT STRAIGHT_JOIN u.name, p.id FROM User u LEFT JOIN u.Phonenumber p ON (p.phonenumber = '123 123')"); } public function testBeforeBodyDelete() { $q = new Doctrine_Query(); $q->parseDqlQuery('DELETE IGNORE FROM User'); $this->assertEqual($q->getSqlQuery(), 'DELETE IGNORE FROM entity WHERE (type = 0)'); $this->assertEqual($q->getDql(), "DELETE IGNORE FROM User"); } public function testBeforeBodyDeleteNoneDQL() { $q = new Doctrine_Query(); $q->delete('IGNORE'); $q->from('User'); $this->assertEqual($q->getSqlQuery(), 'DELETE IGNORE FROM entity WHERE (type = 0)'); $this->assertEqual($q->getDql(), "DELETE IGNORE FROM User"); } public function testBeforeBodyUpdate() { $q = new Doctrine_Query(); $q->parseDqlQuery("UPDATE IGNORE User u SET u.name = 'someone'"); $this->assertEqual($q->getSqlQuery(), "UPDATE IGNORE entity SET name = 'someone' WHERE (type = 0)"); $this->assertEqual($q->getDql(), "UPDATE IGNORE User u SET u.name = 'someone'"); } public function testBeforeBodyUpdateNonDql() { $q = new Doctrine_Query(); $q->update('IGNORE'); $q->from('User u'); $q->set('name', "'someone'"); $this->assertEqual($q->getSqlQuery(), "UPDATE IGNORE entity SET name = 'someone' WHERE (type = 0)"); $this->assertEqual($q->getDql(), "UPDATE IGNORE User u SET name = 'someone'"); } } |
[DC-921] The ability to add WITH ROLLUP to a group by in a query Created: 09/Nov/10 Updated: 18/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major |
| Reporter: | will ferrer | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
XP XAMP |
||
| Description |
|
I figured it would be handy to have a WITH ROLLUP be add able to the group by clause. I added this feature but I can't post the patch because my patches are starting to run together - the syntax with in the generated patch would also contain parts of other patches I have posted to jira but have not yet been included in the doctrine svn. I still wanted to make this post because it will give me a ticket number to base my test cases around. Will Ferrer |
| Comments |
| Comment by will ferrer [ 09/Nov/10 ] |
|
In order to illustrate what this patch fixes I am posting my test case for the patch below <?php /* * $Id$ * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * and is licensed under the LGPL. For more information, see * <http://www.doctrine-project.org>. */ /** * Doctrine_Ticket_DC921_TestCase * * @package Doctrine * @author Will Ferrer * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @category Object Relational Mapping * @link www.doctrine-project.org * @since 1.0 * @version $Revision$ */ class Doctrine_Ticket_DC921_TestCase extends Doctrine_UnitTestCase { public function testAggregateValueMappingSupportsLeftJoinsWithRollUp() { $q = new Doctrine_Query(); $q->select('MAX(u.name), u.*, p.*')->from('User u')->leftJoin('u.Phonenumber p')->groupby('u.id'); $q->setWithRollUp(true); $this->assertEqual($q->getSqlQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id, MAX(e.name) AS e__0 FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) GROUP BY e.id WITH ROLLUP'); } } |
| Comment by will ferrer [ 18/Nov/10 ] |
|
I have updated my implemenation of this feature. Here is the new test case: <?php /* * $Id$ * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * and is licensed under the LGPL. For more information, see * <http://www.doctrine-project.org>. */ /** * Doctrine_Ticket_DC921_TestCase * * @package Doctrine * @author Will Ferrer * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @category Object Relational Mapping * @link www.doctrine-project.org * @since 1.0 * @version $Revision$ */ class Doctrine_Ticket_DC921_TestCase extends Doctrine_UnitTestCase { public function testAggregateValueMappingSupportsLeftJoinsWithRollUp() { $q = new Doctrine_Query(); $q->select('MAX(u.name), u.*, p.*')->from('User u')->leftJoin('u.Phonenumber p')->groupby('u.id'); $q->withRollUp(); $this->assertEqual($q->getSqlQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id, MAX(e.name) AS e__0 FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) GROUP BY e.id WITH ROLLUP'); $this->assertEqual($q->getDql(), 'SELECT MAX(u.name), u.*, p.* FROM User u LEFT JOIN u.Phonenumber p GROUP BY u.id WITH ROLLUP'); } public function testAggregateValueMappingSupportsLeftJoinsWithRollUpDql() { $q = new Doctrine_Query(); $q->parseDqlQuery("SELECT MAX(u.name), u.*, p.* FROM User u LEFT JOIN u.Phonenumber p GROUP BY u.id WITH ROLLUP"); $this->assertEqual($q->getSqlQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id, MAX(e.name) AS e__0 FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) GROUP BY e.id WITH ROLLUP'); $this->assertEqual($q->getDql(), 'SELECT MAX(u.name), u.*, p.* FROM User u LEFT JOIN u.Phonenumber p GROUP BY u.id WITH ROLLUP'); } } |
[DC-919] Import/Pgsql.php: listTableColumns - SQL failure with PostgreSQL Created: 07/Nov/10 Updated: 09/Apr/12 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Import/Export |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Christian Vogel | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | None | ||
| Environment: |
Postgres Import Schema |
||
| Attachments: |
|
| Description |
|
Hi, this issue was reported at the symfony project which uses Doctrine 1.2.3: The SQL Statement 'listTableColumns' fails with an SQL-Error "missing from-clause" Even when i turn on the add_missing_from option on the postgres-server it fails with "missing relation". Now it seems to me, you already fixed this bug in the current 1.2 branch, because the current SQL-Statement is different and it works for me in psql/pgadmin. Could you please close this ticket, if you already fixed this issue, or confirm if it's still an issue? error SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "t" LINE 6: ... t.typtype ... ^. Failing Query: "SELECT ordinal_position as attnum, column_name as field, udt_name as type, data_type as complete_type, t.typtype AS typtype, is_nullable as isnotnull, column_default as default, ( SELECT 't' FROM pg_index, pg_attribute a, pg_class c, pg_type t WHERE c.relname = table_name AND a.attname = column_name AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid AND c.oid = pg_index.indrelid AND a.attnum = ANY (pg_index.indkey) AND pg_index.indisprimary = 't' AND format_type(a.atttypid, a.atttypmod) NOT LIKE 'information_schema%' ) as pri, character_maximum_length as length FROM information_schema.COLUMNS WHERE table_name = 'matable' ORDER BY ordinal_position" |
| Comments |
| Comment by Nahuel Alejandro Ramos [ 09/Nov/10 ] |
|
We apply the diff patch you submit and works perfect. We are using Doctrine 1.2.3 with PostgreSQL 8.4. |
| Comment by Tim Hemming [ 23/Nov/10 ] |
|
We have applied this patch directly to our server-wide Doctrine library and it works fine. We look forward to it becoming a part of the Doctrine distribution. |
| Comment by Christopher Hotchkiss [ 19/Dec/10 ] |
|
I can confirm that this bug also affects symfony 1.4.8 and the attached fix works perfectly! |
| Comment by David Landgren [ 21/Feb/11 ] |
|
Confirmed to fix crash with symfony 1.3.8 |
| Comment by Cesar Miggiolaro [ 09/Apr/12 ] |
|
I use the version 1.4.17 and also had the error with postgres 9.1. Applying the correction suggested in DIFF. The system worked. |
[DC-917] Doctrine take wrong connction Created: 05/Nov/10 Updated: 05/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Connection |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Volodymyr | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I have problems with different connection Doctrine_Manager::getInstance()->bindComponent('Datasource', 'doctrine'); symfony generate me $this->datasources = Doctrine_Core::getTable('datasource') and when i execute it show me error error that can find this table but it take wrong connection by test i tried to add bind component as datasource (first is lower character and it works pretty cool) then i change getTable('datasource') => getTable('Datasource') but it doesn't work public static function test() { return Doctrine_Query::create()->from("Datasource")->execute(); }and it works. |
[DC-916] fetchOne defect Created: 05/Nov/10 Updated: 24/Jan/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major |
| Reporter: | Roman | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
Query fetchOne method now retrieves and hydrates all collection, which can be time consumable. I suggest to add limit 1 in fetchOne method. |
| Comments |
| Comment by Gennady Feldman [ 21/Jan/11 ] |
|
This is a defect. People assume there's an implied limit(1) in the query because of fetchOne(). Please fix this, this is pretty serious stuff. |
| Comment by Gennady Feldman [ 21/Jan/11 ] |
|
Doctrine_Table actually "works around" the issue but explicitly doing limit(1) before doing fetchOne(): public function findOneBy($fieldName, $value, $hydrationMode = null) { return $this->createQuery('dctrn_find') ->where($this->buildFindByWhere($fieldName), (array) $value) ->limit(1) ->fetchOne(array(), $hydrationMode); } |
| Comment by Jonathan H. Wage [ 23/Jan/11 ] |
|
Was this always like this or did it change recently? |
| Comment by Gennady Feldman [ 24/Jan/11 ] |
|
Frankly I have no idea. Also adding a limit(1) shouldn't break anything and is straight forward. We would also want to fix findOneBy not to do limit(1) since fetchOne() should take care of this after the fix is in place. |
[DC-914] Doctrine_Pager ignores custom COUNT query Created: 02/Nov/10 Updated: 07/Nov/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Pager |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Arnoldas Lukasevicius | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Zend Server CE |
||
| Description |
|
I found some problem when I tried to define custom query for results counting. Defined custom COUNT query is totally ignored and executed default one. I will give you full description of problem bellow. We have following source code: $q_select = Doctrine_Query::create () ->select ( 'DISTINCT p.product_name AS product_name' ) ->from ( 'Product p' ) ->where( 'p.product_name LIKE ?', '%motorola%'); $q_count = Doctrine_Query::create () ->select ( 'COUNT (DISTINCT p.product_name) num_results' ) ->from ( 'Product p' ) ->where( 'p.product_name LIKE ?', '%motorola%'); $pager = new Doctrine_Pager( $q_select, 1, 25 ); $pager->setCountQuery($q_count); Let's check custom query before calling $pager->execute() method: echo $pager->getCountQuery(); Output: SELECT COUNT (DISTINCT p.product_name) num_results FROM Product p WHERE p.product_name LIKE ? Looks like until now is everything is correct. Let's call $pager->execute() method: $products = $pager->execute(); Let's check executed queries using Symfony SQL queries log panel: SELECT COUNT(*) AS num_results FROM product p WHERE p.product_name LIKE '%motorola%' 7.27s, "doctrine" connection SELECT DISTINCT p.product_name AS p__0 FROM product p WHERE (p.product_name LIKE '%motorola%') LIMIT 25 3.25s, "doctrine" connection Executed COUNT query is not same we set using $pager->setCountQuery($q_count). Our defined custom COUNT query is totally ignored and executed default one: INSTEAD OF THIS CUSTOM COUNT QUERY: SELECT COUNT (DISTINCT p.product_name) num_results FROM Product p WHERE p.product_name LIKE '%motorola%' EXECUTED DEFAULT COUNT QUERY: SELECT COUNT(*) AS num_results FROM product p WHERE p.product_name LIKE '%motorola%' |
| Comments |
| Comment by Alex Cardoso [ 07/Nov/11 ] |
|
I found a possible solution to the problem. That occurs not because the Pager countQuery but in a method used inside the Query class. When you set the Query or CountQuery for Pager and execute it, it calls a Query method called count(). This method by yourself call another Query class method named Query::getCountSqlQuery(). This method rather than simply execute the query that you passed earlier, simply create a new query. Below is a possible solution to the problem: Query.php (Doctrine Stable 1.2.4)
--- Query.php 2011-11-07 20:52:48.000000000 -0200
+++ Query.php 2011-11-07 20:51:58.000000000 -0200
@@ -2049,40 +2049,7 @@
if (count($this->_queryComponents) == 1 && empty($having)) {
$q .= $from . $where . $groupby . $having;
} else {
-
- // Subselect fields will contain only the pk of root entity
- $ta = $this->_conn->quoteIdentifier($tableAlias);
-
- $map = $this->getRootDeclaration();
- $idColumnNames = $map['table']->getIdentifierColumnNames();
-
- $pkFields = $ta . '.' . implode(', ' . $ta . '.', $this->_conn->quoteMultipleIdentifier($idColumnNames));
-
- // We need to do some magic in select fields if the query contain anything in having clause
- $selectFields = $pkFields;
-
- if ( ! empty($having)) {
- // For each field defined in select clause
- foreach ($this->_sqlParts['select'] as $field) {
- // We only include aggregate expressions to count query
- // This is needed because HAVING clause will use field aliases
- if (strpos($field, '(') !== false) {
- $selectFields .= ', ' . $field;
- }
- }
- // Add having fields that got stripped out of select
- preg_match_all('/`[a-z0-9_]+`\.`[a-z0-9_]+`/i', $having, $matches, PREG_PATTERN_ORDER);
- if (count($matches[0]) > 0) {
- $selectFields .= ', ' . implode(', ', array_unique($matches[0]));
- }
- }
-
- // If we do not have a custom group by, apply the default one
- if (empty($groupby)) {
- $groupby = ' GROUP BY ' . $pkFields;
- }
-
- $q .= '(SELECT ' . $selectFields . ' FROM ' . $from . $where . $groupby . $having . ') '
+ $q .= '( '.$this->getSqlQuery().' ) '
. $this->_conn->quoteIdentifier('dctrn_count_query');
}
return $q;
|
[DC-968] I18n and PostgreSQL and DmVersionable Created: 03/Nov/10 Updated: 15/Feb/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Sasha | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PHP 5.3.2, PostgreSQL 8.4.5, Diem 5.1.x |
||
| Description |
|
I am using PHP 5.3.2 and PostgreSQL 8.4.5, Diem passed all checks in green - OK. I started with "A week of Diem Ipsum" and all went ok until I reached building of blog engine. Blog engine example fails in step: php symfony doctrine:migrate with error message: The following errors occurred:
* SQLSTATE[42830]: Invalid foreign key: 7 ERROR: there is no unique constraint matching given keys for referenced table "article_translation". Failing Query: "ALTER TABLE article_translation_version ADD CONSTRAINT article_translation_version_id_article_translation_id FOREIGN KEY (id) REFERENCES article_translation(id) ON UPDATE CASCADE ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE"
* SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block. Failing Query: "CREATE INDEX article_image ON article (image)"
* SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block. Failing Query: "CREATE INDEX article_author ON article (author)"
* SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block. Failing Query: "CREATE INDEX article_translation_id ON article_translation (id)"
* SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block. Failing Query: "CREATE INDEX article_translation_version_id ON article_translation_version (id)"
I removed i18n support in blog engine example and after that migrate went ok. But in Admin interface when I wanted to add SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block. Again I reviewed the model and removed DmVersionable, migrated again and after that I could loremize or create articles without errors. Additionally, not related directly to this blog engine example but doctrine related, I noticed errors in Diem Admin interface 500 | Internal Server Error | Doctrine_Connection_Pgsql_Exception
SQLSTATE[08P01]: <>: 7 ERROR: bind message supplies 1 parameters, but prepared statement "pdo_stmt_00000008" requires 2
Are this bugs corrected? |
[DC-910] Sub queries do not work properly in the on clause of a join Created: 01/Nov/10 Updated: 02/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | will ferrer | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
XP Xamp |
||
| Attachments: |
|
| Description |
|
When subqueries are used in the on part of a join clause the Doctrine_Query_JoinCondition class does not always create the proper sql. For instance when there are 2 subqueries used in a between doctrine tries to parse the statement as 1 subquery rather 2 subqueries with an "and". I will post my patch that fixes this issue after I make some test cases for it. I also fixed an issue where "(SQL:" syntax was breaking the join as well. Will |
| Comments |
| Comment by will ferrer [ 02/Nov/10 ] |
|
took out some commented code chunks |
[DC-912] A method that can run in a model when the model is autoloaded Created: 01/Nov/10 Updated: 09/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Record |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major |
| Reporter: | will ferrer | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
XP Xamp |
||
| Attachments: |
|
| Description |
|
For my project I needed to be able to reassign connections to models when they are autoloaded – this had to be able to happen during a conservative model loading process before the models had been instantiated. My solution was to build in a hook to a "autoloadSetUp" method which can be attached to any model (or class that is the base for a model). I will post my patch after I make a test case for it. Will Ferrer |
| Comments |
| Comment by will ferrer [ 02/Nov/10 ] |
|
made test case use a static method |
| Comment by will ferrer [ 09/Nov/10 ] |
|
fixed some compatibility issues with the test case and other test cases |
[DC-911] A way of checking if a model has been loaded via the loaded loadModels method Created: 01/Nov/10 Updated: 02/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major |
| Reporter: | will ferrer | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
XP Xamp |
||
| Attachments: |
|
| Description |
|
I needed a way to check if a model has been loaded — checking to see if the model was included in the _loadedModelFiles property of core. I put in a simple function that allows me to test for this. I will post the patch after building a test case for this ticket. Will Ferrer |
| Comments |
| Comment by will ferrer [ 02/Nov/10 ] |
|
Changed the name of the method to modelLoaded (seemed more appropriate) |
[DC-908] Can't save Doctrine Expression AES_ENCRYPT into a utf8_general_ci field Created: 31/Oct/10 Updated: 31/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Record |
| Affects Version/s: | 1.2.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | dquintard | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Win XP |
||
| Description |
|
$membre = new Model_TMembre(); Doesn't works id password field is encoded into utf8_general_ci . Works fine id password field is encoded into latin1 . |
[DC-903] Make Doctrine_Record_UnknownPropertyException error more descriptive Created: 28/Oct/10 Updated: 28/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Attributes |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major |
| Reporter: | Jason Swett | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 10.10 |
||
| Description |
|
If I have a Doctrine object and I try something like $book->getNonexistantThing(), I always get an error like this: It makes it hard to track down the source of the error. Why not have the error include the offending method call? |
[DC-904] Doctrine_Query (execute / fetchOne) memory leak Created: 29/Oct/10 Updated: 03/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | None |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Marcin Dryka | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Environment: |
$ ./symfony -V $ php -v Ubuntu Server (lucid) |
||
| Description |
|
I've created new symfony 1.4.8 project: $ ./symfony -V $ php -v and set the database schema as follows: $ cat config/doctrine/schema.yml I created a task that contains a Doctrine_query call (...) while(1) if (false !== $o)) { $o->free(true); }unset($q, $o); printf("Delta: %s Value: %s\n", Unfortunately, memory usage is increasing: Tested with and without data in database - result is the same. |
| Comments |
| Comment by sonic wang [ 03/Dec/10 ] |
|
i found this bug too. $rcs = $query->execute(array(),\Doctrine_Core::HYDRATE_ON_DEMAND); hydrate not cause memory leak bug hydrate record will cause leak so iterate Doctrine_collection will cause memory leak |
| Comment by Marcin Dryka [ 03/Dec/10 ] |
|
Changing hydration doesn't work for me. Same result for: |
[DC-902] Xcache Cache Driver is not documented Created: 26/Oct/10 Updated: 26/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Caching |
| Affects Version/s: | 1.2.0-ALPHA1, 1.2.0-ALPHA2, 1.2.0-ALPHA3, 1.2.0-BETA1, 1.2.0-BETA2, 1.2.0-BETA3, 1.2.0-RC1, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Piotr Leszczyński | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
All |
||
| Description |
|
Xcache Cache Driver is not documented at all. Is it working? Is it stable? Can we use it? |
[DC-899] Expose hardDelete method on node object when SoftDelete behavior is used Created: 22/Oct/10 Updated: 22/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Behaviors, Nested Set |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major |
| Reporter: | Fernando Varesi | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MySQL |
||
| Description |
|
When combining SoftDelete and NestedSet behavior, there's no way of calling hardDelete method on node object. According to documentation, to peform a delete on a nested set, delete should be called in node object, which will call delete method on the object itself. |
[DC-897] Pager ignores default model hasMany ORDER BY statements, caused by getLimitSubquery ignoring same Created: 22/Oct/10 Updated: 10/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Pager |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Andrew Eross | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Our model configuration includes several hasMany statements, for example: $this->hasMany('Subcategory as Subcategories', array( We noticed that the ORDER BY directive worked just fine with a normal query, but the order by was being ignored when we fed it into the Pager. For example: $pager = new Doctrine_Pager($t, $currentPage, $resultsPerPage); var_dump($bb[4]); These two var_dumps would give different results because the ORDER BY is ignored by the limit subquery in the pager. |
| Comments |
| Comment by Andrew Eross [ 22/Oct/10 ] |
|
I've also found a fix for the issue (thanks to George over here for finding the location of the problem) ... we found that simply moving the ORDER BY generation code inside of buildSqlQuery() to be ABOVE the if block containing getLimitSubquery() resolves the issue. We're not super familiar with the Doctrine code-base, so everything looks to work fine after moving the code block, and it fixes the issue, but would love to hear if this is a real fix. diff from 1.2.3 via our SVN: Index: Query.php + } + // Add the default orderBy statements defined in the relationships and table classes else { + $orderBy = null; + }+ } + + } @@ -1307,47 +1346,8 @@ $q .= ' WHERE ' . $limitSubquerySql . $where;
Property changes on: Query.php
|
| Comment by Andrew Eross [ 22/Oct/10 ] |
|
Diff file |
| Comment by Andrew Eross [ 10/Nov/10 ] |
|
patch -p0 ./libs/doctrine/Doctrine/Query.php ./Doctrine_Query.php.ORDERBY.patch |
[DC-893] Using default value for bigint fields generates an error Created: 19/Oct/10 Updated: 25/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Record |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Dan Osipov | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Replicated on *nix using MySQL DB. |
||
| Description |
|
A field defined as: Generates an error when create-tables is used: The default value is not accounted for. |
| Comments |
| Comment by Paulo Vitor Reis [ 25/Oct/10 ] |
|
20 is the length of the mysql bigint.. |
[DC-892] Typo. in Import/Pgsql.php Created: 19/Oct/10 Updated: 31/Mar/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Import/Export |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Nicolas Ippolito | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Linux and symfony1.4.9 |
||
| Description |
|
Hi, There is maybe a typo. l. 194 in Doctrine/Import/Pgsql.php : typtype should be type? Thanks |
| Comments |
| Comment by Piotr Leszczyński [ 31/Mar/11 ] |
|
Happens to me as well, on windows. |
[DC-889] Using RANDOM() AS rand as last field WITHOUT a comma between them works, but not randomly Created: 14/Oct/10 Updated: 14/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Query |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Dennis Gearon | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
ubuntu 64 bit, using a task in symfony |
||
| Description |
|
The difference between the two code samples below is that there is a comma after 'lo.postal'_code in the second example: This code DOES NOT RANDOMIZE But also DOES NOT PRODUCE A PARSER ERROR This DOES |
[DC-888] Foreign key id columns do not respect ATTR_DEFAULT_IDENTIFIER_OPTIONS Created: 13/Oct/10 Updated: 13/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Migrations, Relations, Schema Files |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Tom Boutell | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Any |
||
| Description |
|
Some time ago Jon Wage suggested that one can override the 8-byte default integer type for IDs by setting Doctrine_Core::ATTR_DEFAULT_IDENTIFIER_OPTIONS in configureDoctrine (in a Symfony project), like this: public function configureDoctrine(Doctrine_Manager $manager) { // Use 4-byte IDs for backwards compatibility with databases built on // Apostrophe 1.4, sfDoctrineGuard pre-5.0, etc. You don't need this for // a brand new site $options = $manager->getAttribute(Doctrine_Core::ATTR_DEFAULT_IDENTIFIER_OPTIONS); $options['length'] = 4; $manager->setAttribute(Doctrine_Core::ATTR_DEFAULT_IDENTIFIER_OPTIONS, $options); }This works for primary key id columns. However it is not respected by foreign key id columns, which do not consult ATTR_DEFAULT_IDENTIFIER_OPTIONS. I looked at working around this using ATTR_DEFAULT_COLUMN_OPTIONS, however it is not type-specific. So if you set a length of 4 with that option, it applies not just to all integers but also to dates, datetimes, booleans and many other things that definitely should not be 4 bytes. The correct fix seems to be for foreign key id columns to respect ATTR_DEFAULT_IDENTIFIER_OPTIONS. Also, ATTR_DEFAULT_COLUMN_OPTIONS should probably let you specify different defaults for each column type as the length option is basically not usable in its current form. But that would not be a particularly clean solution to the foreign key id problem since limiting non-ID integers to 4 bytes should not be necessary.
The motivation for this bug report: The new stable release of sfDoctrineGuardPlugin (for Symfony) does not specify an integer size as it formerly did, so the size of integers now defaults to 8 bytes. This breaks backwards compatibility with existing code that adds foreign key relationships to sfGuard objects like sfGuardUser, etc. Creating migrations to deal with changing this across all tables involved is quite difficult (all foreign key indexes must be dropped and recreated - doctrine:migrations-diff is unable to figure it out, understandably). |
[DC-887] disabling deep option with toArray() drops relations in result Created: 13/Oct/10 Updated: 13/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Record |
| Affects Version/s: | 1.2.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Lex Brugman | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Using the toArray() on a Doctrine_Record object with the deep option set to true (default) correctly converts the whole object to an array including the relations. I've attached a fix. Another solution would be to add a flag that disables deep array conversion but enables relation persistence. |
[DC-886] Doctrine should support mysql native float/double Created: 13/Oct/10 Updated: 13/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Schema Files |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Severin Puschkarski | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
symfony 1.4.8 / mysql |
||
| Description |
|
Doctrine does not support native mysql float/double. It always specifies float(18,2) which reduces precission to 2 decimals. I think doctrine should support mysql native float/double! |
[DC-884] Doctrine_Collection::loadRelated uses getLocal instead of getLocalFieldName Created: 11/Oct/10 Updated: 18/Feb/13 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Record |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Jason Brumwell | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
Windows |
||
| Description |
|
Having a camelcase fieldname with a lowercase column name causes loadRelated of doctrine collection to throw an unknown property error, fix: Change $rel = $this->_table->getRelation($name); if ($rel instanceof Doctrine_Relation_LocalKey || $rel instanceof Doctrine_Relation_ForeignKey) { foreach ($this->data as $record) { $list[] = $record[$rel->getLocal()]; } } to: $rel = $this->_table->getRelation($name); if ($rel instanceof Doctrine_Relation_LocalKey || $rel instanceof Doctrine_Relation_ForeignKey) { foreach ($this->data as $record) { $list[] = $record[$rel->getLocalFieldName()]; } } public function populateRelated($name, Doctrine_Collection $coll) { $rel = $this->_table->getRelation($name); $table = $rel->getTable(); $foreign = $rel->getForeign(); $local = $rel->getLocal(); to public function populateRelated($name, Doctrine_Collection $coll) { $rel = $this->_table->getRelation($name); $table = $rel->getTable(); $foreign = $rel->getForeignFieldName(); $local = $rel->getLocalFieldName(); |
| Comments |
| Comment by Sebastian [ 12/Oct/11 ] |
|
Now this is really poor. This trivial bug is known for over a year not but not yet fixed. Fixing it would save millions of rainforrest trees because people would not have to rely on hundreds of lazy loading queries per page but start to use the getRelation() method. |
| Comment by Sebastian [ 18/Oct/12 ] |
|
Two years now. :'-( |
| Comment by Mishal [ 18/Feb/13 ] |
|
Another year, and all people are probably on Doctrine2. But.... I just pushed your fix #DC-884 to my Doctrine1 fork, if you are interested. |
[DC-885] Building schema doesn't work when tables have cross database foreign keys (MySQL). Created: 12/Oct/10 Updated: 12/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Schema Files |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Fabrice Agnello | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows XP SP3, Apache 2, PHP 5.3, MySQL 5.1.36, Symfony 1.4.8. |
||
| Description |
|
When building schema using the doctrine:build-schena task from multiple databases used in our project, the import process end up with a "missing classname" error without building the schema.yml file. This seems to be caused by the fact that the tables contained in the databases contain foreign keys referencing the other databases tables pks. As an example we have :
When generating the schema, and specifically on the second database step, there are no informations found for the primary keys contained main database. Digging in the import process, it seems that the issue comes from the fact that the Doctrine_Import.importSchema function creates a new definition array instance for every database encountered in the databases.yml. The correction found for this was to take the array() creation one level up before the connections traversing. original code : $manager = Doctrine_Manager::getInstance(); $builder = new Doctrine_Import_Builder(); $builder->setTargetPath($directory); $builder->setOptions($options); $definitions = array(); // <<<<<<<<<<<<<<<<<<< STAYING THERE CAUSES THE "MISSING CLASSNAME" ERROR foreach ($connection->import->listTables() as $table) { ...... modified code : public function importSchema($directory, array $connections = array(), array $options = array()) { $classes = array(); $manager = Doctrine_Manager::getInstance(); $definitions = array(); // <<<<<<<<<<<<<<<<<<PUT HERE foreach ($manager as $name => $connection) { // Limit the databases to the ones specified by $connections. // Check only happens if array is not empty if ( ! empty($connections) && ! in_array($name, $connections)) { continue; } $builder = new Doctrine_Import_Builder(); foreach ($connection->import->listTables() as $table) { |
[DC-882] Doctrine Collection FromArray doesn't adhere to KeyColumn Created: 09/Oct/10 Updated: 09/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Record |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Jason Brumwell | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Using the following in the base class: $this->setAttribute(Doctrine_Core::ATTR_COLL_KEY, 'class'); Then executing a query to array the indexes of the entity are not that of the class field: example: array( 0 => .. 1 => ... ); fix: /**
* Populate a Doctrine_Collection from an array of data
*
* @param string $array
* @return void
*/
public function fromArray($array, $deep = true)
{
$data = array();
foreach ($array as $rowKey => $row) {
$this[$rowKey]->fromArray($row, $deep);
}
}
to /**
* Populate a Doctrine_Collection from an array of data
*
* @param string $array
* @return void
*/
public function fromArray($array, $deep = true)
{
$data = array();
$keyColumn = $this->keyColumn;
foreach ($array as $rowKey => $row) {
$rowKey = $keyColumn AND isset($row[$keyColumn]) ? $row[$keyColumn] : $rowKey;
$this[$rowKey]->fromArray($row, $deep);
}
}
|
[DC-880] Versionable + I18n creates additional migration with irrelevant data Created: 06/Oct/10 Updated: 19/Sep/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Behaviors, I18n, Migrations, Relations |
| Affects Version/s: | 1.2.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Thomas | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
PHP 5.2, Symfony 1.4, Diem 5.1, Doctrine 1.2.2 |
||
| Description |
|
First run of generate-migrations-diff and migrate creates 2 migration diff files. First one for new tables, second one for new indexes and foreign keys. Than if I run generate-migrations-diff again another version is created although nothing was changed and following is inside:
After a long try and errorI found out that it's only happening with I18n plus Versionable behavior. As I already have spent much time for a report please have also a look at: http://forum.diem-project.org/viewtopic.php?f=2&t=173&sid=5e0e3349c0e15a169bc9990a3104b3f6#p465 As I'm quite new to Doctrine and Symfony systems I cannot get further, but willing for more investigation if just one could give me a hint where to start. |
| Comments |
| Comment by Andrew Coulton [ 10/Oct/10 ] |
|
I think this is because the versionable behaviour doesn't define a table name in the Doctrine_Template_Versionable class. As a result, if using model prefixes, the prefixes are not discarded from the table names when the behaviour model classes are built. This means that the tables have different names to what is expected, so they have different index keys, so the indexes are dropped and recreated as part of the migration. I have committed unit tests and patch for this issue (which applies to Searchable also) to http://github.com/acoulton/doctrine1/tree/DC-880 |
| Comment by Daniele Dore [ 19/Sep/11 ] |
|
I experienced the same problem in the latest version 1.2.4, and the patch proposed by Andrew Coulton solves the problem. |
[DC-878] cannot access the version models using object->CLASSNAMEVersion in v1.2.3 Created: 30/Sep/10 Updated: 07/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | |