[DDC-2712] [GH-804] [bugfix] if BIGINT or SMALLINT version field was not incremented. Created: 29/Sep/13  Updated: 30/Sep/13  Resolved: 30/Sep/13

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

Type: Bug Priority: Minor
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of diego-mazzaro:

Url: https://github.com/doctrine/doctrine2/pull/804

Message:

Made version field accepted type coherent between ClassMetadataInfo and BasicEntityPersister



 Comments   
Comment by Doctrine Bot [ 30/Sep/13 ]

A related Github Pull-Request [GH-804] was closed:
https://github.com/doctrine/doctrine2/pull/804

Comment by Guilherme Blanco [ 30/Sep/13 ]

Merged as of https://github.com/doctrine/doctrine2/commit/f02d18f465552947623b15a9916d03faa26e0223





[DDC-2602] Unable to query for entities on postLoad event Created: 07/Aug/13  Updated: 19/Aug/13  Resolved: 19/Aug/13

Status: Closed
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: Git Master
Fix Version/s: 2.x, Git Master
Security Level: All

Type: Bug Priority: Major
Reporter: Guilherme Blanco Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


 Comments   
Comment by Guilherme Blanco [ 19/Aug/13 ]

implemented fix





[DDC-1933] Problem with parameters when clone Doctrine\ORM\QueryBuilder Created: 18/Jul/12  Updated: 23/Jul/12  Resolved: 23/Jul/12

Status: Closed
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.3, Git Master
Fix Version/s: Git Master
Security Level: All

Type: Bug Priority: Major
Reporter: Gandzy Ghennady Assignee: Marco Pivetta
Resolution: Fixed Votes: 1
Labels: None


 Description   

Hi, here problem with cloning \Doctrine\ORM\QueryBuilder

Example
$queryBuilder = new QueryBuilder($em);

$queryBuilder->setParameter('parameter1', 'value1');

$copy = clone $queryBuilder;
$copy->setParameter('parameter2', 'value2');


count($queryBuilder->getParameters()) // equals 2
//expects 1


Solution:

QueryBuilder
public function __clone
{
   ......

   $this->parameters = clone $this->parameters;
}


 Comments   
Comment by Marco Pivetta [ 18/Jul/12 ]

Is `$copy = clone $queryBuilder();` a typo?

Comment by Gandzy Ghennady [ 18/Jul/12 ]

Sorry, this is a typo, was meant: $copy = clone $queryBuilder;

Comment by Marco Pivetta [ 20/Jul/12 ]

This is being handled at DDC-1936 (https://github.com/doctrine/doctrine2/pull/404)

Comment by Gandzy Ghennady [ 20/Jul/12 ]

Hi. Thanks for the quick response.

I looked at the changes, and have a question: whether you need to reset the parameters when cloning? Thus broken backward compatibility with versions <2.3.

Comment by Marco Pivetta [ 20/Jul/12 ]

Actually, I just implemented your expected behaviour (see tests), which is compatible with what the `AbstractQuery` does. It can also be done the other way around, waiting for feedback by Benjamin Eberlei

Comment by Marco Pivetta [ 20/Jul/12 ]

Ah, nevermind. You're right. Will change my code





[DDC-1919] Doctrine fails to escape entity with reserved name in various situations Created: 10/Jul/12  Updated: 19/Jul/12  Resolved: 11/Jul/12

Status: Closed
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: 2.2
Fix Version/s: 2.3, Git Master
Security Level: All

Type: Bug Priority: Major
Reporter: Klaus Silveira Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None
Environment:

MySQL



 Description   

I have submitted a PR here, fixing part of this issue: https://github.com/doctrine/dbal/pull/166

However, it fails when UPDATE or INSERT is used. I'm using a very simple, and common, entity name: Group. Doctrine is failing to escape this in various situations, causing queries to fail in MySQL due to reserved keywords.



 Comments   
Comment by Marco Pivetta [ 11/Jul/12 ]

Can you try using the quoting strategy in master? By defining an '@Table(name="`Group`")' on your entity you should be able to fix this issue by yourself... Anyway, this is only available in latest master.
Please give it a try and let us know.

Comment by Klaus Silveira [ 11/Jul/12 ]

That hack, of course, fixes the problem. However, Doctrine is failing to escape entities with reserved keywords in various different situations and this should be a major problem, specially since there are many keywords that are common table names. Having to change the table name or escape the table name manually is not the best solution.

I have look through the code but could not find out why getQuotedTableName() is failing to quote the table name "Group". I fixed the other problem, involving schema creation, but this one i couldn't fix. That's why i'm opening the issue, hoping someone with more experience in the ORM codebase manages to fix it.

Comment by Marco Pivetta [ 11/Jul/12 ]

Klaus Silveira, doctrine won't quote (at least with the default strategy) a table called "Group". The default strategy will look for the sorrounding "`" ("`Group`").
Is it still failing to quote something in latest master? Can you write a simple example of a failure you are getting?

Comment by Klaus Silveira [ 11/Jul/12 ]

The failure is caused when querying anything related to an entity wich it's name is a reserved keyword, for example, an entity called "Group". I expected Doctrine to quote such table names.

Comment by Marco Pivetta [ 11/Jul/12 ]

Klaus Silveira did you put an @Table(name="`Group`") in it?

Comment by Marco Pivetta [ 11/Jul/12 ]

Please note that

Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
@Table(name="Group")

and

Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
@Table(name="`Group`")

are quite different. That's why I'm asking

Comment by Klaus Silveira [ 11/Jul/12 ]

As i said, that hack fixes the problem. But i don't believe that having to change the table name or escape the table name manually is the best solution. Doctrine should be doing that transparently, as it does for other situations (such as during schema creation). Why not during all other operations? Makes no sense at all.

Comment by Marco Pivetta [ 11/Jul/12 ]

This is not a hack... In ORM, "`" is not the MySQL identifier quote. It is exactly thought as a character with which you tell the ORM that the identifier should be quoted.
The default strategy does make use of it, so please use it.

Comment by Marco Pivetta [ 11/Jul/12 ]

Also, we won't collect the SQL reserved keywords, nor we can know what keywords are used in all vendors. The patch for the quoting strategy was exactly thought to allow end users to use insecure names for their objects/fields/indexes/etc but without having the ORM implement those checks for them (since it would just be messy and too "magic").

Please also reconsider your pull request on github too ( DBAL-298 ).

I'm closing this one

Comment by Klaus Silveira [ 11/Jul/12 ]

Then what's the purpose of Doctrine\DBAL\Platforms\Keywords\MySQLKeywords?

Comment by Marco Pivetta [ 11/Jul/12 ]

Klaus Silveira not sure, but it isn't used in ORM.

Comment by Benjamin Eberlei [ 19/Jul/12 ]

A related Github Pull-Request [GH-166] was closed
https://github.com/doctrine/dbal/pull/166





[DDC-1918] Paginator gives strange results in the end of the resultset Created: 10/Jul/12  Updated: 29/Aug/12  Resolved: 29/Aug/12

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

Type: Bug Priority: Major
Reporter: Alessandro Tagliapietra Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: paginator
Environment:

Mac OSX MAMP (apache + php 5.3.6 + mysql 5)



 Description   

Hello,
i've an image and a tag entities, image has a one to many with tags. I was using limit and offset and it was giving 7 images instead of 9 (limit is set to 9) due one image has 3 tags. So i started using paginator to resolve the join-fetch issue. It worked fine at the beginning of the resultset, the problem is at the end (i have 29 images), when i increase the offset.
These are the last 3 calls:

  • offset 27, distinct query is:

SELECT DISTINCT i0_.id AS id0, i0_.creation_time AS creation_time1 FROM Image i0_ LEFT JOIN Tag t1_ ON i0_.id = t1_.image WHERE i0_.owner = 1 ORDER BY i0_.creation_time DESC LIMIT 9 OFFSET 27

it returns 2 images, correct, so the final query is

SELECT i0_.id AS id0, i0_.name AS name1, i0_.status AS status2, i0_.last_processing AS last_processing3, i0_.creation_time AS creation_time4, i0_.height AS height5, i0_.width AS width6, i0_.layers AS layers7, i0_.foldersize AS foldersize8, i0_.sourcesize AS sourcesize9, i0_.title AS title10, i0_.description AS description11, i0_.originalUrl AS originalUrl12, i0_.private AS private13, i0_.watermark AS watermark14, i0_.favorite AS favorite15, t1_.id AS id16, t1_.tag AS tag17, i0_.owner AS owner18, t1_.image AS image19 FROM Image i0_ LEFT JOIN Tag t1_ ON i0_.id = t1_.image WHERE i0_.owner = 1 AND i0_.id IN (?, ?) ORDER BY i0_.creation_time DESC

with parameters the 2 images id, still correct.

  • offset 29, distinct query is:

SELECT DISTINCT i0_.id AS id0, i0_.creation_time AS creation_time1 FROM Image i0_ LEFT JOIN Tag t1_ ON i0_.id = t1_.image WHERE i0_.owner = 1 ORDER BY i0_.creation_time DESC LIMIT 9 OFFSET 29

which doesn't get any result, but it still goes on querying without id filter:

SELECT i0_.id AS id0, i0_.name AS name1, i0_.status AS status2, i0_.last_processing AS last_processing3, i0_.creation_time AS creation_time4, i0_.height AS height5, i0_.width AS width6, i0_.layers AS layers7, i0_.foldersize AS foldersize8, i0_.sourcesize AS sourcesize9, i0_.title AS title10, i0_.description AS description11, i0_.originalUrl AS originalUrl12, i0_.private AS private13, i0_.watermark AS watermark14, i0_.favorite AS favorite15, t1_.id AS id16, t1_.tag AS tag17, i0_.owner AS owner18, t1_.image AS image19 FROM Image i0_ LEFT JOIN Tag t1_ ON i0_.id = t1_.image WHERE i0_.owner = 1 ORDER BY i0_.creation_time DESC LIMIT 9 OFFSET 29

and it gets the last 2 images maybe due the fetch join like as i'm not using paginator.



 Comments   
Comment by Alessandro Tagliapietra [ 15/Aug/12 ]

No updates?

Comment by Benjamin Eberlei [ 15/Aug/12 ]

Sorry I am swamped with work at the moment and other important projects, I couldnt look into it yet.

Comment by Alessandro Tagliapietra [ 27/Aug/12 ]

Commenting the if this part:

Paginator.php
            // don't do this for an empty id array
            //if (count($ids) > 0) {
                $namespace = WhereInWalker::PAGINATOR_ID_ALIAS;

                $whereInQuery->setHint(Query::HINT_CUSTOM_TREE_WALKERS, array('Doctrine\ORM\Tools\Pagination\WhereInWalker'));
                $whereInQuery->setHint(WhereInWalker::HINT_PAGINATOR_ID_COUNT, count($ids));
                $whereInQuery->setFirstResult(null)->setMaxResults(null);
                foreach ($ids as $i => $id) {
                    $i++;
                    $whereInQuery->setParameter("{$namespace}_{$i}", $id);
                }
            //}

make it works, for me is better, because if you don't have results to show as the result of the select distinct is empty you shouldn't have any result at all. Because if you don't add the "WHERE IN" query you get the results joined with no difference between using or not the paginator.

Comment by Benjamin Eberlei [ 29/Aug/12 ]

This is weird, an empty IN() normally produces an error. We could add a non matching condition instead, like 0 = 1.

Comment by Alessandro Tagliapietra [ 29/Aug/12 ]

Not really, in my case (mysql) it creates the following query:

SELECT i0_.id AS id0, i0_.name AS name1, i0_.status AS status2, i0_.last_processing AS last_processing3, i0_.creation_time AS creation_time4, i0_.height AS height5, i0_.width AS width6, i0_.layers AS layers7, i0_.foldersize AS foldersize8, i0_.sourcesize AS sourcesize9, i0_.title AS title10, i0_.description AS description11, i0_.originalUrl AS originalUrl12, i0_.private AS private13, i0_.watermark AS watermark14, i0_.favorite AS favorite15, t1_.id AS id16, t1_.tag AS tag17, i0_.owner AS owner18, t1_.image AS image19 FROM Image i0_ LEFT JOIN Tag t1_ ON i0_.id = t1_.image WHERE i0_.owner = 1 AND i0_.id IS NULL ORDER BY i0_.creation_time DESC

so it sets "AND i0_.id IS NULL" which solves the problem, the best solution for me is to directly return an empty set if the DISTINCT gives no results.

Comment by Alessandro Tagliapietra [ 29/Aug/12 ]

Solved with commit bc2476f342ceda98559b87a314806581cf969796





[DDC-1711] [GH-306] by r1pp3rj4ck: Fixed fetch mapping in xsd Created: 16/Mar/12  Updated: 03/Dec/13  Resolved: 18/Mar/12

Status: Closed
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: Git Master
Security Level: All

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


 Description   

This issue is created automatically through a Github pull request on behalf of r1pp3rj4ck:

Url: https://github.com/doctrine/doctrine2/pull/306

Message:

It was 'EXTRALAZY' and the constant name in ClassMetadata is 'EXTRA_LAZY'.

It's really annoying that my IDE says it's a wrong attribute.



 Comments   
Comment by Alexander [ 18/Mar/12 ]

Merged: https://github.com/doctrine/doctrine2/commit/1b2b831febb780d8153bc4f8684baa763dd8f177

Comment by Doctrine Bot [ 03/Dec/13 ]

A related Github Pull-Request [GH-306] was closed:
https://github.com/doctrine/common/pull/306





[DDC-1505] EntityManager->find returning null for entity on the inverse side of a OneToOne association Created: 23/Nov/11  Updated: 18/Dec/11  Resolved: 18/Dec/11

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: Git Master
Fix Version/s: 2.x, Git Master

Type: Bug Priority: Critical
Reporter: Chris Richard Assignee: Alexander
Resolution: Fixed Votes: 0
Labels: None


 Description   

BasicEntityPersister.getJoinSQLForJoinColumns treats joinColumn nullable setting as defaulting to false:

if(isset($joinColumn['nullable']) && $joinColumn['nullable'])

{ return 'LEFT JOIN'; }

I think it should be:

if(!isset($joinColumn['nullable']) || $joinColumn['nullable']){ return 'LEFT JOIN'; }

 Comments   
Comment by Benjamin Eberlei [ 15/Dec/11 ]

Assigned to asm

Comment by Benjamin Eberlei [ 18/Dec/11 ]

This issue is referenced in Github Pull-Request GH-226
https://github.com/doctrine/doctrine2/pull/226

Comment by Alexander [ 18/Dec/11 ]

Should be fixed as soon as this is pulled:
https://github.com/doctrine/doctrine2/pull/226

Comment by Benjamin Eberlei [ 18/Dec/11 ]

Related Pull Request was closed: https://github.com/doctrine/doctrine2/pull/226





[DDC-985] [PATCH] Fix attempt to get column by class property name Created: 13/Jan/11  Updated: 23/Jan/11  Resolved: 23/Jan/11

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

Type: Bug Priority: Major
Reporter: David Deller Assignee: Benjamin Eberlei
Resolution: Duplicate Votes: 0
Labels: None


 Description   

PULL REQUEST: https://github.com/doctrine/doctrine2/pull/27

After upgrading from a Doctrine 2.0 RC to final version, I noticed a failure when using doctrine orm:schema:create:

[Doctrine\DBAL\Schema\SchemaException]
There is no column with name '_id' on table 'subuser'.

Since this worked before the upgrade, I investigated and found a new line of code that was attempting to get a column using the class identifier property name (_id) rather than the mapped column name (user_id). Please see patch.



 Comments   
Comment by Benjamin Eberlei [ 23/Jan/11 ]

This is a duplicate of a previous issue and is fixed in master.





[DDC-904] No identifier/primary key specified for Entity with inheritance Created: 01/Dec/10  Updated: 05/Jan/11  Resolved: 30/Dec/10

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

Type: Bug Priority: Major
Reporter: Clément JOBEILI Assignee: Roman S. Borschel
Resolution: Invalid Votes: 0
Labels: None
Environment:

Mac, MySQL, PHP 5.3.3



 Description   

Hi,

I think i found a little bug with doctrine and the inheritance on differente Symfony2 Bundle.

Here is the pb :

I use the DoctrineUserBundle (https://github.com/knplabs/DoctrineUserBundle) for one of my testing application, it's provide a nice way to handle user and session management trough a Symfony2 app.

I create an DoctrineUserBundle in my own Application Folder and I create an User sub class that inherit the User base class in the bundle with the annotation way.
When I run the doctrine:generate:entities command it's telling me:

No identifier/primary key specified for Entity 'Application\DoctrineUserBundle\Entity\User'. Every Entity must have an identifier/primary key.

But the User (base class of DoctrineUserBundle) has a primary key but with the xml way.

Do you think it's a bug ?

Thanks a lot



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

Now i get it. This is not a bug.

You cannot mix mappings from annotations and xml to define a single entity mapping. Its not possible.

Comment by Benjamin Eberlei [ 01/Dec/10 ]

One Solution would be to add annotations to the User bae class. That would have to be on the DoctrineUserBundle then.

Comment by Clément JOBEILI [ 01/Dec/10 ]

Ok ! Thanks but one thing is that the creator of this bundle (ornicar) has created a website called lichess.org and use DoctrineUserBundle.

In this app, he created a User.php sub classing the Base User of DoctrineUserBundle and he used annotations but with mongodb

https://github.com/ornicar/lichess/blob/master/src/Application/DoctrineUserBundle/Document/User.php

How it's possible that it works with ODM and not with ORM ?

THanks a lot for your time

Comment by Benjamin Eberlei [ 02/Dec/10 ]

Hm maybe its a bug with mapped superclasses. I thought Ornicar did a little hack there regarding mixing.

But in general ORM != ODM.

Comment by Benjamin Eberlei [ 30/Dec/10 ]

That bug happens when the Doctrine UserBundle is not detected correctly.

It should be fixed with the current Symfony2 state of code.

Comment by Joaquín Bravo Contreras [ 04/Jan/11 ]

So now we are able to mix mappings or something else was fixed.

Because right now I'm getting the same error using latest symfony-sandbox code.

Comment by Benjamin Eberlei [ 05/Jan/11 ]

read the master docs of symfony2 please, there was a change in configuration:

http://docs.symfony-reloaded.org/master/guides/doctrine/orm/overview.html





Generated at Fri Apr 18 13:25:43 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.