[DDC-925] Breaks with Fixing Identification Variables and SQL Walkers - 2 Created: 10/Dec/10  Updated: 10/Dec/10  Resolved: 10/Dec/10

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.0-RC1
Fix Version/s: 2.0-RC2
Security Level: All

Type: Bug Priority: Major
Reporter: gektor Assignee: Roman S. Borschel
Resolution: Fixed Votes: 0
Labels: None
Environment:

Ubuntu


Issue Links:
Reference
relates to DDC-736 Nasty ordering issue with fetch-joins Resolved

 Description   

Here is a part from the file with bug code.

Doctrine/ORM/Query/Parser.php
Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
// Fix order of identification variables.
// They have to appear in the select clause in the same order as the
// declarations (from ... x join ... y join ... z ...) appear in the query
// as the hydration process relies on that order for proper operation.
if ( count($this->_identVariableExpressions) > 1) {
  foreach ($this->_queryComponents as $dqlAlias => $qComp) {
    if (isset($this->_identVariableExpressions[$dqlAlias])) {
      $expr = $this->_identVariableExpressions[$dqlAlias];
      $key = array_search($expr, $AST->selectClause->selectExpressions);
      unset($AST->selectClause->selectExpressions[$key]);
      $AST->selectClause->selectExpressions[] = $expr;
    }
  }
}

Bug details

Doctrine/ORM/Query/Parser.php
Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
$key = array_search($expr, $AST->selectClause->selectExpressions);
unset($AST->selectClause->selectExpressions[$key]);
      

When array_search function return false (no match).
Then on the next line wrong array element deleted, because (int) false = 0
}:-[



 Comments   
Comment by Benjamin Eberlei [ 10/Dec/10 ]

Add test, this issue does not appear anymore with the fix for DDC-915.





[DDC-920]  Undefined index in UnitOfWork when detach entity without flush Created: 09/Dec/10  Updated: 10/Dec/10  Resolved: 10/Dec/10

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.0-RC1
Fix Version/s: 2.0-RC2
Security Level: All

Type: Bug Priority: Trivial
Reporter: Martin Vidensky Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This code causes undefined index

$entity = new ... // some entity

$em->persist($entity);
$em->detach($entity); // throw notice Doctrine/ORM/UnitOfWork.php on line 1114

But this works well

$entity = new ... // some entity

$em->persist($entity);
$em->flush();
$em->detach($entity);



 Comments   
Comment by Benjamin Eberlei [ 10/Dec/10 ]

Fixed





[DDC-918] Remove UnitOfWork->flush() in Query->doExecute() Created: 08/Dec/10  Updated: 10/Dec/10  Resolved: 10/Dec/10

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0-RC2
Security Level: All

Type: Improvement Priority: Critical
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

We should remove UnitOfWork->flush() inside the Query class and document clearly the adverse effects that can happen.

Its much better peformance wise this way around and people shouldn't get into trouble.



 Comments   
Comment by Benjamin Eberlei [ 10/Dec/10 ]

Changed and noted in the new ReST branch of the docs that will go live before release.





[DDC-917] using generator strategy AUTO leads to duplicate squences drops (on PostgreSQL) when using inheritance Created: 07/Dec/10  Updated: 08/Dec/10  Resolved: 08/Dec/10

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: Git Master
Fix Version/s: 2.0-RC2
Security Level: All

Type: Bug Priority: Major
Reporter: Lukas Kahwe Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This is the base definition:
https://github.com/knplabs/DoctrineUserBundle/blob/symfony2Security/Resources/config/doctrine/metadata/orm/Bundle.DoctrineUserBundle.Entity.User.dcm.xml

It uses

       <id name="id" type="integer" column="id">
           <generator strategy="AUTO" />
       </id>

This class is inherited 2 times.
When generating the drop sql it gives the following (note the user_user_like and user_user_interest entities use generator strategy IDENTITY):

Soitgoes:foo lsmith$ app/main/console_dev doctrine:schema:drop --dump-sql
DROP SEQUENCE doctrine_user_user_id_seq;
DROP SEQUENCE doctrine_user_user_id_seq;
DROP SEQUENCE doctrine_user_user_id_seq;
DROP SEQUENCE doctrine_user_user_id_seq;
ALTER TABLE user_user_like DROP CONSTRAINT user_user_like_user_id_fkey;
ALTER TABLE user_user_like DROP CONSTRAINT user_user_like_user_like_id_fkey;
ALTER TABLE user_user_interest DROP CONSTRAINT user_user_interest_user_id_fkey;
ALTER TABLE user_user_interest DROP CONSTRAINT user_user_interest_user_interest_id_fkey;
DROP TABLE user_user_like;
DROP TABLE user_user_interest;
DROP TABLE doctrine_user_user;
DROP TABLE user_like;
DROP TABLE user_interest

Soitgoes:foo lsmith$ app/main/console_dev doctrine:schema:create --dump-sql
ATTENTION: This operation should not be executed in an production enviroment.

CREATE TABLE doctrine_user_user (id INT NOT NULL, username VARCHAR(255) NOT NULL, username_lower VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, is_active BOOLEAN NOT NULL, is_super_admin BOOLEAN NOT NULL, password VARCHAR(255) NOT NULL, algorithm VARCHAR(127) NOT NULL, salt VARCHAR(127) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, last_login TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, confirmation_token VARCHAR(127) DEFAULT NULL, remember_me_token VARCHAR(127) DEFAULT NULL, firstname VARCHAR(255) NOT NULL, lastname VARCHAR(255) NOT NULL, profile_token VARCHAR(10) NOT NULL, has_accepted_terms BOOLEAN NOT NULL, facebookID VARCHAR(50) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, gender VARCHAR(1) DEFAULT NULL, age INT DEFAULT NULL, phone_number VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id));
CREATE UNIQUE INDEX doctrine_user_user_username_uniq ON doctrine_user_user (username);
CREATE UNIQUE INDEX doctrine_user_user_username_lower_uniq ON doctrine_user_user (username_lower);
CREATE UNIQUE INDEX doctrine_user_user_email_uniq ON doctrine_user_user (email);
CREATE UNIQUE INDEX doctrine_user_user_facebookID_uniq ON doctrine_user_user (facebookID);
CREATE TABLE user_user_like (user_id INT NOT NULL, user_like_id INT NULL, PRIMARY KEY(user_id, user_like_id));
CREATE INDEX user_user_like_user_like_id_idx ON user_user_like (user_like_id);
CREATE UNIQUE INDEX user_user_like_user_id_uniq ON user_user_like (user_id);
CREATE TABLE user_user_interest (user_id INT NOT NULL, user_interest_id INT NULL, PRIMARY KEY(user_id, user_interest_id));
CREATE INDEX user_user_interest_user_interest_id_idx ON user_user_interest (user_interest_id);
CREATE UNIQUE INDEX user_user_interest_user_id_uniq ON user_user_interest (user_id);
CREATE TABLE user_interest (id SERIAL NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id));
CREATE TABLE user_like (id SERIAL NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id));
CREATE SEQUENCE doctrine_user_user_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
ALTER TABLE user_user_like ADD FOREIGN KEY (user_id) REFERENCES doctrine_user_user(id) NOT DEFERRABLE INITIALLY IMMEDIATE;
ALTER TABLE user_user_like ADD FOREIGN KEY (user_like_id) REFERENCES user_like(id) NOT DEFERRABLE INITIALLY IMMEDIATE;
ALTER TABLE user_user_interest ADD FOREIGN KEY (user_id) REFERENCES doctrine_user_user(id) NOT DEFERRABLE INITIALLY IMMEDIATE;
ALTER TABLE user_user_interest ADD FOREIGN KEY (user_interest_id) REFERENCES user_interest(id) NOT DEFERRABLE INITIALLY IMMEDIATE


 Comments   
Comment by Benjamin Eberlei [ 08/Dec/10 ]

Fixed





[DDC-915] Breaks with Fixing Identification Variables and SQL Walkers Created: 07/Dec/10  Updated: 10/Dec/10  Resolved: 08/Dec/10

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0-RC2
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Reference
relates to DDC-736 Nasty ordering issue with fetch-joins Resolved

 Description   

I think that this patch breaks modifying the select clause in custom tree walkers because walking the select clause will be done after the $_identVariableExpressions array is populated. Reordering the identification variables will then override the modifi



 Comments   
Comment by Benjamin Eberlei [ 08/Dec/10 ]

Fixed





[DDC-901] Docs DQL Custom Walkers CountSqlWalker example error Created: 29/Nov/10  Updated: 12/Dec/10  Resolved: 12/Dec/10

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: Git Master
Fix Version/s: 2.0-RC2
Security Level: All

Type: Bug Priority: Major
Reporter: Chris Martin Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

Getting invalid SQL when using the CountSqlWalker example in the DQL Custom Walkers docs:

SELECT count(DISTINCT z0_.) AS sclr0 FROM ...

From what looks like this part of the example:

...
$pathExpression = new PathExpression(
    PathExpression::TYPE_STATE_FIELD | PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION, $parentName, array(
    $parent['metadata']->getSingleIdentifierFieldName())
);
...

If you move the field name (3rd parameter) out of the array, it seems to work:

...
$pathExpression = new PathExpression(
    PathExpression::TYPE_STATE_FIELD | PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION, $parentName, 
    $parent['metadata']->getSingleIdentifierFieldName()
);
...
SELECT count(DISTINCT z0_.id) AS sclr0 FROM ...


 Comments   
Comment by Benjamin Eberlei [ 12/Dec/10 ]

Fixed





[DDC-800] Wrong anchor target (404) Created: 11/Sep/10  Updated: 12/Dec/10  Resolved: 12/Dec/10

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.0-RC2
Security Level: All

Type: Bug Priority: Minor
Reporter: Jan Pieper Assignee: Jonathan H. Wage
Resolution: Fixed Votes: 0
Labels: None
Environment:

Irrelevant



 Description   

There is an wrong anchor target within your ORM reference documentation.

URL: http://www.doctrine-project.org/projects/orm/2.0/docs/reference/annotations-reference/en#ann_changetrackingpolicy

diff --git a/manual/en/annotations-reference.txt b/manual/en/annotations-reference.txt
index fa15468..fb331d3 100644
--- a/manual/en/annotations-reference.txt
+++ b/manual/en/annotations-reference.txt
@@ -81,7 +81,7 @@ strategy, which means upon flush UnitOfWork compares all the properties of an en
 snapshot. This works out of the box, however you might want to tweak the flush performance where using
 another change tracking policy is an interesting option.
 
-The [details on all the available change tracking policies](/../configuration#change-tracking-policies)
+The [details on all the available change tracking policies](/change-tracking-policies)
 can be found in the configuration section.
 
 Example:
@@ -608,4 +608,4 @@ Example:
      * @column(type="integer")
      * @version
      */
-    protected $version;
\ No newline at end of file
+    protected $version;

I hope this is a valid fix.



 Comments   
Comment by Benjamin Eberlei [ 12/Dec/10 ]

This is fixed in the new docs.





Generated at Sun Oct 26 04:38:33 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.