[DDC-1800] Paginator results is wrong if your query use order by clause Created: 27/Apr/12  Updated: 17/Apr/14  Resolved: 29/Aug/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.2.2
Fix Version/s: 2.3, 2.3.1
Security Level: All

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

linux oracle



 Description   

NOTE: I didn't try this on other database, I'm using Oracle.

if my original fetchJoin query use an order by clause, the results is not keeping the provided order by clause and re-order them by id.

here is my generated query to get the distinct records that get generated:

SELECT distinct ID0
FROM
(
SELECT f0_.id AS ID0, f0_.deal_type_id AS DEAL_TYPE_ID1, f0_.title AS TITLE2, f0_.deal_date AS DEAL_DATE3, f0_.amount AS AMOUNT4,
f0_.abstract AS ABSTRACT5, f0_.created_date AS CREATED_DATE6, f0_.last_updated_date AS LAST_UPDATED_DATE7,
f0_.object_status_id AS OBJECT_STATUS_ID8, f0_.published_date AS PUBLISHED_DATE9, f0_.publishing_status_id AS PUBLISHING_STATUS_ID10,
f1_.id AS ID11, f1_.role_id AS ROLE_ID12, f1_.role_type_id AS ROLE_TYPE_ID13, f2_.id AS ID14, f3_.id AS ID15, f4_.id AS ID16, f5_.id AS ID17,
c6_.id AS ID18, d7_.id AS ID19
FROM fo_deal f0_
INNER JOIN fo_deal_role f1_ ON f0_.id = f1_.deal_id
INNER JOIN fo_people f2_ ON f1_.people_id = f2_.id
INNER JOIN fo_property_deal f3_ ON f0_.id = f3_.deal_id
INNER JOIN fo_property f4_ ON f3_.property_id = f4_.id
LEFT JOIN fo_property_asset f5_ ON f4_.id = f5_.property_id
LEFT JOIN co_asset c6_ ON f5_.asset_id = c6_.id
LEFT JOIN ds_record d7_ ON c6_.ds_id = d7_.id
WHERE f1_.people_id = 2
AND f0_.object_status_id <> 3
AND f0_.publishing_status_id = 2
ORDER BY f0_.deal_date DESC, f0_.published_date DESC
)

running this query I get the id 30, 44 when the inner query return 44, 30

here is the query that should get generated to take care of the order by clause:
SELECT distinct ID0, rownum+
FROM
(
SELECT f0_.id AS ID0, f0_.deal_type_id AS DEAL_TYPE_ID1, f0_.title AS TITLE2, f0_.deal_date AS DEAL_DATE3, f0_.amount AS AMOUNT4,
f0_.abstract AS ABSTRACT5, f0_.created_date AS CREATED_DATE6, f0_.last_updated_date AS LAST_UPDATED_DATE7,
f0_.object_status_id AS OBJECT_STATUS_ID8, f0_.published_date AS PUBLISHED_DATE9, f0_.publishing_status_id AS PUBLISHING_STATUS_ID10,
f1_.id AS ID11, f1_.role_id AS ROLE_ID12, f1_.role_type_id AS ROLE_TYPE_ID13, f2_.id AS ID14, f3_.id AS ID15, f4_.id AS ID16, f5_.id AS ID17,
c6_.id AS ID18, d7_.id AS ID19
FROM fo_deal f0_
INNER JOIN fo_deal_role f1_ ON f0_.id = f1_.deal_id
INNER JOIN fo_people f2_ ON f1_.people_id = f2_.id
INNER JOIN fo_property_deal f3_ ON f0_.id = f3_.deal_id
INNER JOIN fo_property f4_ ON f3_.property_id = f4_.id
LEFT JOIN fo_property_asset f5_ ON f4_.id = f5_.property_id
LEFT JOIN co_asset c6_ ON f5_.asset_id = c6_.id
LEFT JOIN ds_record d7_ ON c6_.ds_id = d7_.id
WHERE f1_.people_id = 2
AND f0_.object_status_id <> 3
AND f0_.publishing_status_id = 2
ORDER BY f0_.deal_date DESC, f0_.published_date DESC
) ORDER BY rownum ASC

To fix this on the Paginator code:

file: ORM/Tools/Pagination/LimitSubqueryOutputWalker.php
method: walkSelectStatement

change:
$sql = sprintf('SELECT b.*, rownum as rn FROM (SELECT DISTINCT %s FROM (%s)) b', // AS _dctrn_result',
implode(', ', $sqlIdentifier), $sql);

for:
$sql = sprintf('SELECT b.*, rownum as rn FROM (SELECT DISTINCT %s, numrow FROM (%s) ORDER BY numrow ASC) b', // AS _dctrn_result',
implode(', ', $sqlIdentifier), $sql);



 Comments   
Comment by Marc Drolet [ 14/May/12 ]

rownum instead of numrow. sorry.

$sql = sprintf('SELECT b.*, rownum as rn FROM (SELECT DISTINCT %s, rownum FROM (%s) ORDER BY rownum ASC) b',
implode(', ', $sqlIdentifier), $sql);

Comment by Benjamin Eberlei [ 07/Jul/12 ]

Doctrine 2.2.2 doesnt have the LimitSubqueryoutputWalker and Doctrine 2.3-dev does not have the line in the code. Can you make a more explicit statement of where the change is necessary?

Comment by Marc Drolet [ 09/Jul/12 ]

It's in the Pagination of version 2.2.2. ORM/Tools/Pagination/LimitSubqueryOutputWalker.php

Comment by Benjamin Eberlei [ 09/Jul/12 ]

This is the 2.2 branch, https://github.com/doctrine/doctrine2/tree/2.2/lib/Doctrine/ORM/Tools/Pagination and https://github.com/doctrine/doctrine2/tree/2.2.2/lib/Doctrine/ORM/Tools/Pagination is the 2.2.2 tag.

no LimitSubqueryOutputWalker.php in there.

Comment by Benjamin Eberlei [ 29/Aug/12 ]

Fixed

Comment by Raymond Kolbe [ 09/Apr/13 ]

This issue is popping it's head up again!

Benjamin, your tests don't test for the ordering problem unless those tests are happening somewhere else?

https://github.com/doctrine/doctrine2/commit/f55b5411c8b1f75bf2b5cf5ffe4bc50034fb91cb

I am performing a query as complex as Marc's and I experience the same exact issue. I have checked out today's latest master branch as well as the 2.3 tag with no change.

Please advise.

Comment by Raymond Kolbe [ 09/Apr/13 ]

I have a PR in https://github.com/doctrine/doctrine2/pull/645





[DDC-2012] Inserting a new entity with a custom mapping type does not call convertToDatabaseValueSQL() when using InheritanceType("JOINED") Created: 04/Sep/12  Updated: 17/Apr/14  Resolved: 03/Oct/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: 2.2.3
Fix Version/s: 2.3.1
Security Level: All

Type: Bug Priority: Critical
Reporter: Kaspars Sproģis Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None
Environment:

PHP


Attachments: Text File DDC2012Test.php     File DDC2012Test.php    

 Description   

When using class type inheritance - @InheritanceType("JOINED") and inserting new entity with a custom mapping type, custom type method convertToDatabaseValueSQL() is never called.

Here is sample class mapping:

Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
 
/**
 * @Table(name="item")
 * @Entity
 * @InheritanceType("JOINED")
 * @DiscriminatorColumn(name="type_id", type="smallint")
 * @DiscriminatorMap({1 = "ItemPerson"})
 */
class Item {

	/**
	 * @Column(name="tsv", type="tsvector", nullable=true)
	 */
	protected $tsv;
}

/**
 * @Table(name="item_person")
 * @Entity
 */
class ItemPerson extends Item
{
}

I am using the same custom TsvectorType with simple entities and even Mapped Superclasses and it works perfectly, however on InheritanceType("JOINED") method convertToDatabaseValueSQL() is never called :/
Hope someone knows how to fix this.
Thank you.



 Comments   
Comment by Fabio B. Silva [ 24/Sep/12 ]

Hi Kaspars,

I can't reproduce,
Could you change the added testcase and try to make it fails ?

Thanks

Comment by Kaspars Sproģis [ 26/Sep/12 ]

@Fabio thanks for looking into my problem
I attached test where you can detect the problem.

It was quite strange, all i did was changed column that uses custom type to array and some minimal convertToDatabaseValue and convertToDatabaseValueSQL logic and convertToDatabaseValueSQL was never called.

One more thing i noticed, this bug only appears on persist and not on merge.

Thanks

Comment by Fabio B. Silva [ 29/Sep/12 ]

Thanks Kaspars

But sorry, I dont get your use case.

Notice that convertToDatabaseValueSQL is called just when using queries to find a object by a especific columns which is your mapping type.

http://docs.doctrine-project.org/en/2.1/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html#the-mapping-type

Comment by Kaspars Sproģis [ 29/Sep/12 ]

I am using PostgreSQL tsvector data type for full text search.

Here is my tsvector custom data type class:
https://gist.github.com/3129096

The only way to update this field in postgresql is to use postgresql function to_tsvector('some text').
And everything works fine, if i persist simple entity, this method transforms insert query as needed:

public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
{
	return sprintf('to_tsvector(%s)', $sqlExpr);
}

But when i use inheritance, then by some reason convertToDatabaseValueSQL method is not called and tsv field is updated with simple text as returned by convertToDatabaseValue() method.
I modified the Ticket Test so that you can see exact moment of when it is not called, which is exactly my problem.

Here is the result after persisting (for persist it failed)

$person = new ItemPerson();
$person->setName('some words for test');
$em->persist($person);
$em->flush();

DB Result:
Name                | Tsv
--------------------|------------------------------------
some words for test | 'for' 'some' 'test' 'words'

Here is the result after second time update (now by tsv format you can see it worked):

$person->setName('some more words for test');
$em->flush();

DB Result:
Name                | Tsv
--------------------|------------------------------------
some words for test | 'test':5 'word':3
Comment by Fabio B. Silva [ 30/Sep/12 ]

Thanks Kaspars

Now i saw the problem

Writing a patch ...

Comment by Kaspars Sproģis [ 03/Oct/12 ]

Just tested fixed version and everything works perfectly now.
Thank you!

Comment by Fabio B. Silva [ 03/Oct/12 ]

Fixed by : https://github.com/doctrine/doctrine2/commit/91caff1d8965c20b72d5fdd04ffadf3ab063c1ba





[DDC-2050] [GH-459] Fix DDC-2012 Created: 30/Sep/12  Updated: 17/Apr/14  Resolved: 03/Oct/12

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

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


 Description   

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

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

Message:

http://www.doctrine-project.org/jira/browse/DDC-2012



 Comments   
Comment by Benjamin Eberlei [ 03/Oct/12 ]

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

Comment by Doctrine Bot [ 22/Dec/13 ]

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





[DDC-2059] Property perceived as dumplicate in composite foreign key Created: 04/Oct/12  Updated: 17/Apr/14  Resolved: 05/Oct/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: 2.1.3
Fix Version/s: 2.3.1
Security Level: All

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


 Description   

I have the following schema:

CREATE TABLE `user` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
);

CREATE TABLE `project` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
);

CREATE TABLE `project_conversation` (
  `project_id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`project_id`,`user_id`)
)

I have ommitted the foreign key definitions for better readability. When I execute doctrine:mapping:convert (in Symfony2, but it seems it's a Doctrine2 issue), I get the following error:

[Doctrine\ORM\Mapping\MappingException]                                               
Property "user" in "Project" was already declared, but it must be declared only once

I have tracked down the issue to be caused by the existence of `user_id` in the project table. So basically, because `project_conversation` references `project` which in turn references `user`, `project_conversation` reference to `user` is perceived as duplicate.

I don't think that this should be the expected behavior though. user_id in `project` references the creator of the project while user_id in `project_conversation` references the creator of the conversation and thus I think the schema is valid.



 Comments   
Comment by Benjamin Eberlei [ 05/Oct/12 ]

Will be fixed in 2.2.4 and 2.3.1





[DDC-2068] [GH-474] Fixed bug with comment option not being added to column. Created: 11/Oct/12  Updated: 17/Apr/14  Resolved: 12/Oct/12

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

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


 Description   

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

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

Message:

Title explains everything... =)



 Comments   
Comment by Benjamin Eberlei [ 12/Oct/12 ]

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

Comment by Doctrine Bot [ 29/Dec/13 ]

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





[DDC-1977] Undefined index in ParameterTypeInferer Created: 10/Aug/12  Updated: 17/Apr/14  Resolved: 25/Aug/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.2.3
Fix Version/s: 2.3, 2.3.1
Security Level: All

Type: Bug Priority: Minor
Reporter: Matt Button Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None
Environment:

PHP 5.3.6-13ubuntu3.8 with Suhosin-Patch (cli) (built: Jun 13 2012 17:19:54)

{ "package": "doctrine/common", "version": "2.2.2" }

,

{ "package": "doctrine/dbal", "version": "2.2.x-dev", "source-reference": "b961a3fce6bf220f1dca47d7d747b9074bea4730", "commit-date": "1341779435" }

,

{ "package": "doctrine/doctrine-bundle", "version": "dev-master", "source-reference": "62134e6a8dd3f330131ee6a970f0cee1d7760c1d", "commit-date": "1343203511" }

,

{ "package": "doctrine/orm", "version": "2.2.x-dev", "source-reference": "5d2a3bcb3b467f41ee58575764f3ba84937f76e4", "commit-date": "1341676080" }

,



 Description   

Trying to bind an empty array as a parameter to a raw SQL query results in an undefined index error on line 59.

https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Query/ParameterTypeInferer.php#L59



 Comments   
Comment by Matt Button [ 10/Aug/12 ]

One way to work around this is to specify the type of the array as the third parameter to addParameter

Comment by Fabio B. Silva [ 25/Aug/12 ]

Fixed by : https://github.com/doctrine/doctrine2/commit/ece6a005bcecc4a9e4a154d9379cfbe141370415





[DDC-2174] [GH-526] [DDC-2172] Fix EntityGenerator get literal type Created: 27/Nov/12  Updated: 11/Feb/14  Resolved: 27/Nov/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4, 2.3.1
Security Level: All

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


 Description   

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

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

Message:

http://www.doctrine-project.org/jira/browse/DDC-2172



 Comments   
Comment by Benjamin Eberlei [ 27/Nov/12 ]

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

Comment by Fabio B. Silva [ 27/Nov/12 ]

Merged : https://github.com/doctrine/doctrine2/commit/29f0b678cfb991e90af3eed023fb8c62ec8f7acf

Comment by Doctrine Bot [ 11/Feb/14 ]

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





[DDC-2168] [GH-523] [DDC-2074] Bugfix regarding clearing cloned PersistentCollections Created: 25/Nov/12  Updated: 08/Feb/14  Resolved: 25/Nov/12

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

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


 Description   

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

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

Message:

When calling clear on a PC that has no owner (e.g. because it was cloned), it can't be deleted as there is no metadata available (that's essentially the exception mentioned in the ticket). In these cases, I think it shouldn't be scheduled for deletion, but please have a look as my knowledge of the ORM internals is limited.



 Comments   
Comment by Benjamin Eberlei [ 25/Nov/12 ]

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

Comment by Doctrine Bot [ 08/Feb/14 ]

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





[DDC-2123] [GH-502] Fix for invalid 'double-ON' SQL generation with entity inheritance type JOINED. Created: 05/Nov/12  Updated: 08/Feb/14  Resolved: 06/Nov/12

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

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


 Description   

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

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

Message:

In SqlWalker::walkJoin(), SqlWalker::walkRangeVariableDeclaration() can be
called which may produce an 'ON' clause if the entity inheritance type is
JOINED. As walkJoin() may then produce another ON clause, this results in
invalid SQL (e.g. '... ON foo = bar ON (baz = quux) ...' when the inheritance
type is JOINED.

This adds a test and a fix for the problem, by checking for an inheritance type
of JOINED in walkJoin() and using AND instead of ON in the appropriate place.

It seems like this part of the code is begging to be refactored. This is my
first foray into Doctrine internals and can't see a way to do this without
stomping all over the rest of the code, but this section seems ripe for cleanup
by somebody who is familiar.



 Comments   
Comment by Benjamin Eberlei [ 06/Nov/12 ]

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

Comment by Fabio B. Silva [ 06/Nov/12 ]

Merged : https://github.com/doctrine/doctrine2/commit/7a895209e3d9912bcc44fc8e8635dd48164a4749

Comment by Doctrine Bot [ 08/Feb/14 ]

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





[DDC-2126] [GH-505] Fix errors in JoinClassPathExpression and SqlWalker Created: 05/Nov/12  Updated: 08/Feb/14  Resolved: 06/Nov/12

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

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


 Description   

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

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

Message:

  • Fixes a typo in a variable name in JoinClassPathExpression::dispatch()
  • Fixes an exception throw: QueryException::invalidPathExpression() expects a PathExpression, not a string
  • Removes two references to an undefined class AST\ArithmeticPrimary


 Comments   
Comment by Benjamin Eberlei [ 06/Nov/12 ]

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

Comment by Fabio B. Silva [ 06/Nov/12 ]

Merged : https://github.com/doctrine/doctrine2/commit/6949a957826960e4cb8c4cf405a6c4528bbb2f84

Comment by Doctrine Bot [ 08/Feb/14 ]

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





[DDC-2129] [GH-508] Fix and test for DDC-2073 Created: 06/Nov/12  Updated: 14/Jan/14  Resolved: 12/Nov/12

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

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


 Description   

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

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

Message:

Fix and test for DDC-2073(http://www.doctrine-project.org/jira/browse/DDC-2073).

Ticket extract:

> PersistentCollection::matching() always returns empty collection, when passed criteria's expression is created using ExpressionBuilder::isNull()
> This happens because expression created by ExpressionBuilder::isNull() is wrongly translated to SQL using '=' operator instead of 'IS NULL'.
> If the collection is already loaded, result is as expected.



 Comments   
Comment by Matthieu Napoli [ 06/Nov/12 ]

Argh this issue should be closed, I apparently failed linking the pull request to DDC-2073

Comment by Benjamin Eberlei [ 06/Nov/12 ]

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

Comment by Doctrine Bot [ 14/Jan/14 ]

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





[DDC-1518] Method chaining in Setters of generated entity classes Created: 02/Dec/11  Updated: 09/Jan/14  Resolved: 09/Jan/14

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

Type: Improvement Priority: Minor
Reporter: Christian Stoller Assignee: Benjamin Eberlei
Resolution: Duplicate Votes: 0
Labels: None
Environment:

Symfony2



 Description   

Hi.
It would be nice if the set-methods of the generated entity classes would return the entity instance itself, so that method chaining is possible.
Example:

$user = new User();
$user->setUsername()
     ->setFirstname()
     ->setEmail();

In PHP 5.4 we can do even more nicer:

$user = new User()
     ->setUsername()
     ->setFirstname()
     ->setEmail();

If this is not wanted by everyone, the console tool could get a new argument to define if method chaining should be used or not.

Implementation of this improvement would be very nice. Thanks.



 Comments   
Comment by Christian Stoller [ 09/Jan/14 ]

This has already been fixed





[DDC-2116] [GH-498] Improve DocBlock annotations of generated entities Created: 02/Nov/12  Updated: 08/Jan/14  Resolved: 05/Nov/12

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

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


 Description   

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

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

Message:

Currently, the DocBlock annotations for member variables contain the variable name as description which is redundant and should be removed. Furthermore the class is annotated with the FQN instead of just the name. This makes automatically generated documentation quite ugly.

These changes will result in entities that as follows

```
/**

  • User
    *
  • @ORM\Table()
  • @ORM\Entity
    */
    class User
    {
    /**
  • @var string
    *
  • @ORM\Column(name="name", type="string", length=255)
    */
    private $name;
    ```

instead of this:

```
/**

  • Some\Completely\Random\Namespace\User <--- FQN is not needed here
    *
  • @ORM\Table()
  • @ORM\Entity
    */
    class User
    {
    /**
  • @var string $name <--- description is better left blank instead of using variable name
    *
  • @ORM\Column(name="name", type="string", length=255)
    */
    private $name;
    ```


 Comments   
Comment by Markus Lanthaler [ 02/Nov/12 ]

Just noticed that the message the doctrinebot posts on GitHub contains a typo: "thank you for **positing** this Pull Request". Don't know where to report this so I do it directly here

Comment by Benjamin Eberlei [ 03/Nov/12 ]

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

Comment by Fabio B. Silva [ 05/Nov/12 ]

Merged : https://github.com/doctrine/doctrine2/commit/515847bece281fe6a04f49b9a65fd10102c44f80

Comment by Doctrine Bot [ 08/Jan/14 ]

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





[DDC-2122] [GH-501] Allow 0 id for Entity Created: 05/Nov/12  Updated: 08/Jan/14  Resolved: 05/Nov/12

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

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


 Description   

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

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

Message:

When using a 0 id, it's throwing InvalidArgumentException (Binding entities to query parameters only allowed for entities that have an identifier.)��



 Comments   
Comment by Benjamin Eberlei [ 05/Nov/12 ]

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

Comment by Fabio B. Silva [ 05/Nov/12 ]

Merged : https://github.com/doctrine/doctrine2/commit/ff80e99cc955c0842df9b376c7cd6506b2e41653

Comment by Doctrine Bot [ 08/Jan/14 ]

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





[DDC-2115] [GH-496] Testing for key existance in basicEntityPersister / getIndividualValue Created: 02/Nov/12  Updated: 05/Jan/14  Resolved: 06/Nov/12

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

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


 Description   

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

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

Message:

wrapping the setting of value with an array_key_exists to prevent a notice from being thrown



 Comments   
Comment by Benjamin Eberlei [ 06/Nov/12 ]

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

Comment by Fabio B. Silva [ 06/Nov/12 ]

Merged : https://github.com/doctrine/doctrine2/commit/57e5fa98733f7a4f507845c6ade41bc16859add7

Comment by Doctrine Bot [ 05/Jan/14 ]

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





[DDC-2086] [GH-484] Prevented "Undefined index" notice when updating Created: 17/Oct/12  Updated: 31/Dec/13  Resolved: 25/Oct/12

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

Type: Bug Priority: Trivial
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: unitofwork
Environment:

OS X 10.8.2, PHP 5.3.17, Nginx 1.2.4 (php through FPM)



 Description   

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

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

Message:

While executing updates on an entity scheduled for update without a change-set, an "Undefined index" notice is raised.

This issue will occur when you manually call $em()->getUnitOfWork()->scheduleForUpdate() on an entity that hasn't changed. The entity will be included in UnitOfWork::$entityUpdates, but because there are no changes, its oid will not be included in UnitOfWork::$entityChangeSets.

I know I'm misusing scheduleForUpdate() a bit in this case, but the notice can easily be prevented with a !empty().



 Comments   
Comment by Benjamin Eberlei [ 22/Oct/12 ]

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

Comment by Fabio B. Silva [ 25/Oct/12 ]

Merged : https://github.com/doctrine/doctrine2/commit/cd7ef6e7a70d4ff4c25a85fdae71676aa6548ea6

Comment by Doctrine Bot [ 31/Dec/13 ]

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





[DDC-2082] [GH-481] check for false as a return value from get_parent_class(), not null Created: 16/Oct/12  Updated: 30/Dec/13  Resolved: 24/Oct/12

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

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


 Description   

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

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

Message:

MappingException::identifierRequired() and MappingException::classIsNotAValidEntityOrMappedSuperClass() both check for null, when they should check for false from get_parent_class().



 Comments   
Comment by Benjamin Eberlei [ 22/Oct/12 ]

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

Comment by Fabio B. Silva [ 24/Oct/12 ]

Merged : https://github.com/doctrine/doctrine2/commit/9d0b254407e6f8827e0f00aa4ed0fcefc6111aad

Comment by Doctrine Bot [ 30/Dec/13 ]

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





[DDC-2067] [GH-473] Fixes bug whereby orphan-removal value in XMLDriver is incorrectly parsed as true Created: 11/Oct/12  Updated: 29/Dec/13  Resolved: 12/Oct/12

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

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


 Description   

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

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

Message:

I realise this is very hand wavy and if you require some more information or test cases then I can see about that.

However, just to get the issue logged, as I just spent 3 hours reverse engineering the doctrine code to find this, and it may help someone else.

Basically when reading the XML mapping data from generated XML files the orphan-removal value was being incorrectly parse as 'true' when it was set to 'false' in the mapping file.

I think this is because the XML parser was parsing the attribute as an object and when it was casted a boolean this meant the value became true. To overcome this I first cast the value as a string, and then to a bool.

Let me know if you need more information.

Thanks.



 Comments   
Comment by Doctrine Bot [ 29/Dec/13 ]

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





[DDC-2072] [GH-477] fixed typo Created: 12/Oct/12  Updated: 29/Dec/13  Resolved: 12/Oct/12

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

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


 Description   

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

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

Message:



 Comments   
Comment by Benjamin Eberlei [ 12/Oct/12 ]

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

Comment by Doctrine Bot [ 29/Dec/13 ]

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





[DDC-2044] [GH-455] Fixed unique-constraint name in XML Exporter Created: 26/Sep/12  Updated: 22/Dec/13  Resolved: 05/Oct/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4, 2.3.1
Security Level: All

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


 Description   

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

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

Message:



 Comments   
Comment by Benjamin Eberlei [ 05/Oct/12 ]

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

Comment by Doctrine Bot [ 22/Dec/13 ]

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





[DDC-1241] Additional parameters for EntityRepository::findAll() and EntityRepository::findOneBy() Created: 01/Jul/11  Updated: 23/Aug/13  Resolved: 06/Nov/12

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

Type: Improvement Priority: Trivial
Reporter: Jasper N. Brouwer Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 1
Labels: None


 Description   

In the Doctrine 2.1 versions the method EntityRepository::findBy() accepts additional parameters for ordering, limit and offset.
Great feature! (While waiting for it I extended the EntityRepository class and implemented these parameters myself using a QueryBuilder.)

It would be nice for the method EntityRepository::findOneBy() to accept an additional parameter for ordering as well. It could use the following signature:
public function findOneBy(array $criteria, array $orderBy = null);
This would be useful for various cases, for example: finding the newest blog-post.

And maybe update EntityRepository::findAll() as well with the signature:
public function findAll(array $orderBy = null);

Looking forward to your thoughts.



 Comments   
Comment by Dieter Provoost [ 27/Jul/11 ]

I can't seem to find the implementation of this even though this issue has been resolved. Is this possible?

Comment by Benjamin Eberlei [ 27/Jul/11 ]

It was only added to "findBy"

Comment by Jasper N. Brouwer [ 27/Jul/11 ]

So the resolution is actually a "won't fix" (in stead of "fixed")?

I know this was added to "findBy", but my request was to extend the "findOneBy" and "findAll" as well...

Comment by Dieter Provoost [ 27/Jul/11 ]

Can it also be added to "findOneBy"? It would come in very handy for the use case above (for example: finding the newest blog-post).
Otherwise, I think we are limited to the alternative using "findBy" with the orderBy parameter (thus fetching all entries, followed by returning only the first/last) or using a native query.

Comment by Benjamin Eberlei [ 27/Jul/11 ]

Reopened for 2.2 with implementation for "findOneby()"

Comment by Guilherme Blanco [ 20/Dec/11 ]

Updating fix version

Comment by Paweł Nowak [ 05/Nov/12 ]

A proposed implementation of findOneBy with ordering is available with the following pull request: https://github.com/doctrine/doctrine2/pull/504.

Comment by Fabio B. Silva [ 06/Nov/12 ]

Fixed : https://github.com/doctrine/doctrine2/commit/283ed55824b7c713611e4b1e336551be805c48b5

Comment by Dmitry Pashkevich [ 23/Aug/13 ]

What about extending the signature of EntityRepository::findAll() to this?
public function findAll(array $orderBy = null);

I like this idea, it would allow cleaner code when querying records without criteria:
$users->findAll(array('name'=>'ASC'));
instead of
$users->findBy(array(), array('name'=>'ASC'));





[DDC-1958] pager produces wrong results on postgresql Created: 30/Jul/12  Updated: 06/Aug/13  Resolved: 12/Nov/12

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

Type: Bug Priority: Major
Reporter: Miha Vrhovnik Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 1
Labels: paginator
Environment:
  • Postgres 9.1, 9.2
  • PHP 5.4

Sub-Tasks:
Key
Summary
Type
Status
Assignee
DDC-2593 Same bug occurs in MariaDB 5.5 Sub-task Open Benjamin Eberlei  
DDC-2729 Same bug affects SQLServer2008Platform Sub-task Open Benjamin Eberlei  

 Description   

The query build by pager to get the subset of PKs to fetch produces wrong results on potgresql (and probably any database), that conforms to the SQL standard. The standard says, that if you wish to have the results in specific order, then you have to specify that by using an ORDER BY clause. If such a clause is not present the database can return the results in whatever order it sees fit.

Testcase fixtures:

CREATE TABLE test (
    id integer,
    name text
);

INSERT INTO test VALUES (1, 'c');
INSERT INTO test VALUES (2, 'a');
INSERT INTO test VALUES (3, 'e');
INSERT INTO test VALUES (4, 'b');
INSERT INTO test VALUES (5, 'd');
INSERT INTO test VALUES (6, 'a');
INSERT INTO test VALUES (7, 'g');
INSERT INTO test VALUES (8, 'h');
INSERT INTO test VALUES (9, 'e');
INSERT INTO test VALUES (10, 'j');

Passing f.e.

$qb = $this->repository
    ->createQueryBuilder('t')
    ->select('t')
    ->setFirstResult(0)
    ->setMaxResults(5)
    ->addOrderBy('t.name', 'ASC')

to pager produces SQL like this modified for readability

SELECT DISTINCT id FROM (
    SELECT id, name FROM test ORDER BY name
  ) dctrn_result
  LIMIT 5 OFFSET 0

Now there is nothing wrong with this modified query per se, but there is no ORDER BY clause in the outer query so according to the standard the DB can choose whatever order it seems fit. Now mysql chooses the same order, but postgresql does not and it's probably not the only DB doing so.

If you are interested in the results, this is the output I'm seeing:

  • postgresql: 8,4,1,5,3
  • mysql : 2,6,4,1,5

I and my coworker came to the standard compliant solution it was also tested on the dataset above on both postgresql and mysql and it produced equal results. We have found only one corner case this won't work and IMHO that can't be fixed. The problem is when you do a sort on a field from a table that is in 1:n relation to the main table.. e.g tables posts and tags, where one post can have a multiple tags and you want your results sorted by a tag.

Recipe for a correct query is:

  • remember the ORDER BY fields from original query and then remove them
  • wrap the original query with a DISTINCT query, but add the fields from ORDER BY to the SELECT part of that query and add the whole ORDER BY to the end of it, also add the PK to the order by clause, and add the LIMIT clause
  • wrap the resulting query into another query and select just the id.

so if I take the example from above the SQL should look like this:

SELECT id FROM (
  SELECT DISTINCT id, name FROM (
    SELECT id, name FROM test
  ) dctrn_result_inner
  ORDER BY name, id LIMIT 5 OFFSET 0
) dctrn_result


 Comments   
Comment by Jean-Philippe THEVENOUX [ 08/Nov/12 ]

I reproduce same problem with Postgres 7.4, Doctrine 2.3 whereas with doctrine 2.2, all is fine
Hope there'll a fix in next doctrine version

Comment by Raymond Kolbe [ 09/Apr/13 ]

http://www.doctrine-project.org/jira/browse/DDC-1800 This relates.

I just published a PR for an Oracle fix, but your solution appears to work for Oracle as well (issue is the same).

Comment by Bojidar Hristov [ 06/Aug/13 ]

Same bug occurs in MariaDB 5.5.

I commented out check for PostgreSQL and it works fine. Can you fix it for MariaDB too? Thanks





[DDC-2182] [GH-529] Options join columns Created: 01/Dec/12  Updated: 04/Dec/12  Resolved: 04/Dec/12

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

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


 Description   

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

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

Message:

When a columns as the options with unsigned at true, this options is not passed to the joinColumn.
This PR fix this.






[DDC-2172] GENERATOR_TYPE_UUID missing in EntityGenerator.php Created: 27/Nov/12  Updated: 27/Nov/12  Resolved: 27/Nov/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: 2.4, 2.3.1
Security Level: All

Type: Bug Priority: Major
Reporter: Paul R Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None
Environment:

Codeigniter 2



 Description   

Hey guys!

In my model I used UUID as the generator strategy for my id:
@GeneratedValue(strategy="UUID")
It works for creating my UUID but when I add some changes to my model and run
orm:generate-entities --generate-annotations="true" models/
it throws the following exception:
"[InvalidArgumentException]
Invalid provided IdGeneratorType: 6 "

Looking at the EntityGenerator.php I saw that the UUID type is not (yet?) in there. When I add it to the function getIdGeneratorTypeString() everything works fine...
I'm new to Doctrine so I'm not sure if this is actually a bug, but it seems weird to me



 Comments   
Comment by Fabio B. Silva [ 27/Nov/12 ]

Fixed : https://github.com/doctrine/doctrine2/commit/29f0b678cfb991e90af3eed023fb8c62ec8f7acf





[DDC-2074] ManyToManyPersister not found in the chain configured namespaces Created: 12/Oct/12  Updated: 25/Nov/12  Resolved: 25/Nov/12

Status: Closed
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.2.3
Fix Version/s: 2.3.1
Security Level: All

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

Symfony 2.1



 Description   

The error is: "The class 'Doctrine\ORM\Persisters\ManyToManyPersister' was not found in the chain configured namespaces"

Replicate by making an entity which has a property which is self referencing; e.g. http://docs.doctrine-project.org/en/latest/reference/association-mapping.html#many-to-many-self-referencing .

For example an Album could be related to any other similar albums. An album entity would have a property 'relatedAlbums' which is an ArrayCollection. Similarly, I could be working on a CMS where any piece of content could be related to any other in order to show a "related content" or "related posts" style list on a web page.

Using Symfony 2.1 and a Symfony Form with FormBuilder make sure to use the 'by_reference' => false to call the setter for the property. In the setter for the property: https://gist.github.com/3879169

A similar question has been asked on StackOverflow: http://stackoverflow.com/questions/12077084/doctrine2-manytomany-self-referencing



 Comments   
Comment by Benjamin Eberlei [ 12/Oct/12 ]

I need a stacktrace for this error, i have no clue why this happens and where.

Comment by Steffan Harries [ 15/Oct/12 ]

Stack Trace:

The class 'Doctrine\ORM\Persisters\ManyToManyPersister' was not found in the chain configured namespaces Gedmo\Tree\Entity, Gedmo\Translatable\Entity, MyProject\Bundle\AdminBundle\Entity, MyProject\Bundle\Common\SiteBundle\Entity, MyProject\Bundle\Common\ContentBundle\Entity, FOS\UserBundle\Entity

500 Internal Server Error - MappingException

Stack Trace

in /opt/local/apache2/htdocs/projects/my-project/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php at line 38
*/
public static function classNotFoundInNamespaces($className, $namespaces)

{ return new self("The class '" . $className . "' was not found in the ". "chain configured namespaces " . implode(", ", $namespaces)); }

at MappingException ::classNotFoundInNamespaces ('Doctrine\ORM\Persisters\ManyToManyPersister', array('Gedmo\Tree\Entity', 'Gedmo\Translatable\Entity', 'MyProject\Bundle\AdminBundle\Entity', 'MyProject\Bundle\Common\SiteBundle\Entity', 'MyProject\Bundle\Common\ContentBundle\Entity', 'FOS\UserBundle\Entity'))
in /opt/local/apache2/htdocs/projects/my-project/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php at line 114
at MappingDriverChain ->loadMetadataForClass ('Doctrine\ORM\Persisters\ManyToManyPersister', object(ClassMetadata))
in /opt/local/apache2/htdocs/projects/my-project/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php at line 112
at ClassMetadataFactory ->doLoadMetadata (object(ClassMetadata), null, false, array())
in /opt/local/apache2/htdocs/projects/my-project/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php at line 302
at AbstractClassMetadataFactory ->loadMetadata ('Doctrine\ORM\Persisters\ManyToManyPersister')
in /opt/local/apache2/htdocs/projects/my-project/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php at line 205
at AbstractClassMetadataFactory ->getMetadataFor ('Doctrine\ORM\Persisters\ManyToManyPersister')
in /opt/local/apache2/htdocs/projects/my-project/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php at line 268
at EntityManager ->getClassMetadata ('Doctrine\ORM\Persisters\ManyToManyPersister')
in /opt/local/apache2/htdocs/projects/my-project/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php at line 169
at ManyToManyPersister ->_getDeleteSQL (object(PersistentCollection))
in /opt/local/apache2/htdocs/projects/my-project/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/AbstractCollectionPersister.php at line 89
at AbstractCollectionPersister ->delete (object(PersistentCollection))
in /opt/local/apache2/htdocs/projects/my-project/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php at line 328
at UnitOfWork ->commit (null)
in /opt/local/apache2/htdocs/projects/my-project/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php at line 355
at EntityManager ->flush (null)
in kernel.root_dir/cache/dev/jms_diextra/doctrine/EntityManager_5075974d574d6.php at line 362
at EntityManager ->flush ()
in /opt/local/apache2/htdocs/projects/my-project/src/MyProjectBundle/Common/ContentBundle/Controller/ContentController.php at line 170
at ContentController ->updateAction (object(Request), '3')
at call_user_func_array (array(object(ContentController), 'updateAction'), array(object(Request), '3'))
in kernel.root_dir/bootstrap.php.cache at line 1421
at HttpKernel ->handleRaw (object(Request), '1')
in kernel.root_dir/bootstrap.php.cache at line 1385
at HttpKernel ->handle (object(Request), '1', true)
in kernel.root_dir/bootstrap.php.cache at line 1561
at HttpKernel ->handle (object(Request), '1', true)
in kernel.root_dir/bootstrap.php.cache at line 612
at Kernel ->handle (object(Request))
in /opt/local/apache2/htdocs/projects/my-project/web/app_dev.php at line 28

Comment by Benjamin Eberlei [ 25/Nov/12 ]

Ok apparently this is fixed





[DDC-2158] [GH-518] regression fix for left joins (double ON) Created: 20/Nov/12  Updated: 25/Nov/12  Resolved: 25/Nov/12

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

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


 Description   

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

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

Message:



 Comments   
Comment by Benjamin Eberlei [ 25/Nov/12 ]

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





[DDC-2144] PersistentCollection Criteria IS NULL not behaving as expected Created: 14/Nov/12  Updated: 14/Nov/12  Resolved: 14/Nov/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.3
Fix Version/s: 2.3.1

Type: Bug Priority: Major
Reporter: Aitor Suso Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

When using the matching method of a persistentCollection with a Criteria that contains a call to isNull, the SQL generated contains "field = null" instead of "field IS null"



 Comments   
Comment by Aitor Suso [ 14/Nov/12 ]

Seen that the code is fixed in the 2.3 branch, but it isn't in the last stable release (2.3.0)





[DDC-2109] Duplicate joinTableColumns mapping for ManyToMany with resolve target entity Created: 31/Oct/12  Updated: 12/Nov/12  Resolved: 12/Nov/12

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

Type: Bug Priority: Major
Reporter: Michaël Gallego Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

OS X 10.8


Attachments: File ResolveTargetEntityListenerTest.php    

 Description   

I use the resolve target entity listener quite often for generic code. However I found an issue with ManyToMany relationships, when the target entity is modified by the listener.

The problem is that the _validateAndCompleteManyToManyMapping in PersistentCollection duplicate the joinTableColumns, so this means that when creating an entity, Doctrine send twice the number of parameters, which of course fail.

Here is a test that reproduce the problem.

public function testAssertTableColumnsAreNotAddedInManyToMany()
    {
        $evm = $this->em->getEventManager();
        $this->listener->addResolveTargetEntity(
            'Doctrine\Tests\ORM\Tools\ResolveTargetInterface',
            'Doctrine\Tests\ORM\Tools\ResolveTargetEntity',
            array()
        );
        $this->listener->addResolveTargetEntity(
            'Doctrine\Tests\ORM\Tools\TargetInterface',
            'Doctrine\Tests\ORM\Tools\TargetEntity',
            array()
        );
        $evm->addEventListener(Events::loadClassMetadata, $this->listener);
        $cm = $this->factory->getMetadataFor('Doctrine\Tests\ORM\Tools\ResolveTargetEntity');
        $meta = $cm->associationMappings['manyToMany'];

        $this->assertSame('Doctrine\Tests\ORM\Tools\TargetEntity', $meta['targetEntity']);
        $this->assertEquals(array('resolvetargetentity_id', 'targetinterface_id'), $meta['joinTableColumns']);
    }





[DDC-2073] PersistentCollection::matching() always returns empty collection, when passed criteria's expression is created using ExpressionBuilder::isNull() Created: 12/Oct/12  Updated: 12/Nov/12  Resolved: 12/Nov/12

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

Type: Bug Priority: Blocker
Reporter: Pavol Kirschbaum Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 1
Labels: None


 Description   

This happens because expression created by ExpressionBuilder::isNull() is wrongly translated to SQL using '=' operator instead of 'IS NULL'.

If the collection is already loaded, result is as expected.



 Comments   
Comment by Matthieu Napoli [ 06/Nov/12 ]

Pull request: https://github.com/doctrine/doctrine2/pull/508





[DDC-2071] [GH-476] Replaced the setting of Ids to the whereInQuery with a more performant implementation Created: 12/Oct/12  Updated: 12/Nov/12  Resolved: 12/Nov/12

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

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


 Description   

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

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

Message:

While working with large datasets in combination with pagination (ie. a pagination window of 100 or more), the performance drastically decreased.

I tracked the problem down to the setting of the parameters. In the old implementation, the parameters are set individually. This pull request sets the parameter as an array to the Query and Walker.

Testing results (# of entities, original performance, improved performance):
32 0,036 0,033
64 0,043 0,037
128 0,065 0,043
256 0,133 0,057
512 0,360 0,088
1024 1,212 0,157
2048 4,462 0,332
4096 17,203 0,818






[DDC-2079] Error in build entities using yml with several inversedJoinColumns Created: 15/Oct/12  Updated: 09/Nov/12  Resolved: 21/Oct/12

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

Type: Bug Priority: Critical
Reporter: André Antônio Lemos de Moraes Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None
Environment:

windows 7/php 5.3/apache 2.2



 Description   

Hello guys, sorry for the bad English found the error during a necessity and would like to post the solution.

Below is an example of my yml relationamento a many to many.

manyToMany:
centroCustos:
targetEntity: Album\Entity\CentroCusto
cascade: ["persist", "merge"]
inversedBy: unidades
joinTable:
name: unidade_centro_custo
joinColumns:
idunidade:
referencedColumnName: idunidade
onDelete: cascade
inverseJoinColumns:
idcentrocusto:
referencedColumnName: idcentrocusto
idpais:
referencedColumnName: idpais
idmundo:
referencedColumnName: idmundo
onDelete: cascade

Well this example is generating this code.

/**

  • @var \Doctrine\Common\Collections\ArrayCollection
    *
  • @ORM\ManyToMany(targetEntity="Album\Entity\CentroCusto", inversedBy="unidades", cascade= {"persist","merge"}

    )

  • @ORM\JoinTable(name="unidade_centro_custo",
  • joinColumns= { * @ORM\JoinColumn(name="idunidade", referencedColumnName="idunidade", onDelete="cascade") * }

    ,

  • inverseJoinColumns= { * @ORM\JoinColumn(name="idcentrocusto", referencedColumnName="idcentrocusto") * @ORM\JoinColumn(name="idpais", referencedColumnName="idpais") * @ORM\JoinColumn(name="idmundo", referencedColumnName="idmundo", onDelete="cascade") * }
  • )
    */

Notice that Doctrine 2 is not putting commas to separate JoinColumns.

So looking at the source code I found the following code and put it solved my problem.

The changes was performed in EntityGenerator.php line 1090.

$arrJoins = array();
foreach ($associationMapping['joinTable']['joinColumns'] as $joinColumn)

{ $arrJoins[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); }

$lines[] = implode(",". PHP_EOL, $arrJoins);
$lines[] = $this->spaces . ' * },';
$lines[] = $this->spaces . ' * inverseJoinColumns={';

$arrJoinsInverse = array();
foreach ($associationMapping['joinTable']['inverseJoinColumns'] as $joinColumn)

{ $arrJoinsInverse[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); }

$lines[] = implode(",". PHP_EOL, $arrJoinsInverse);
$lines[] = $this->spaces . ' * }';
$lines[] = $this->spaces . ' * )'; }

I hope you understand what I'm trying to say, for you do not know if this error occurred, but if there ocorrei is one possible solution.

Thank you.



 Comments   
Comment by Fabio B. Silva [ 21/Oct/12 ]

Fixed by : https://github.com/doctrine/doctrine2/commit/2c0feb2a46a7cf97dc2878e6214924c3ffdbce67





[DDC-2069] Spaces are not ignored in the "column" list of a uniqueConstraints Created: 12/Oct/12  Updated: 09/Nov/12  Resolved: 21/Oct/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: 2.3
Fix Version/s: 2.3.1
Security Level: All

Type: Bug Priority: Minor
Reporter: Matthieu Napoli Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: yaml


 Description   

In a YAML configuration file

Behavior correct for this:

  uniqueConstraints:
    myConstraint:
      columns: column1,column2

However, if I add a space in the "columns" list:

  uniqueConstraints:
    myConstraint:
      columns: column1, column2

I end up with the following exception:

exception 'Doctrine\DBAL\Schema\SchemaException' with message 'There is no column with name ' column2' on table 'myTable'.

This can be very confusing, especially if (by any chance) you have a line return just on the space in the command line: you never see the space in the exception message.

It seems that YAML allows spaces in lists (http://en.wikipedia.org/wiki/YAML#Lists), but this line doesn't seem to be a YAML list. If it is parsed by Doctrine (split on ","), spaces should be ignored (or trimmed).



 Comments   
Comment by Matthieu Napoli [ 17/Oct/12 ]

Note that using the correct YAML format works:

uniqueConstraints:
    myConstraint:
      columns: [column1, column2]

So it's confusing to have 2 possibilities to write the same thing, and that they don't behave the same.

Comment by Fabio B. Silva [ 21/Oct/12 ]

Fixed by : https://github.com/doctrine/doctrine2/commit/814f2f9e039caf712b75af7f61d28c361189bcab





[DDC-2113] SQLFilter incorrect results when WHERE clause contains OR expression Created: 01/Nov/12  Updated: 09/Nov/12  Resolved: 05/Nov/12

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

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


 Description   

When using an SQLFilter, if applied to a query that contains only OR expressions in the WHERE clause, the generated SQL is incorrect.

Example:

  • SQLFilter returns a constraint like "{$tableAlias}.accountid={$accountId}"
  • Query: "SELECT u FROM User u WHERE u.fname='bob' OR u.lname='bob'"

Resulting SQL:
"SELECT u FROM User u WHERE u.fname='bob' OR u.lname='bob' AND u.accountid=2"

Expected:
"SELECT u FROM User u WHERE (u.fname='bob' OR u.lname='bob') AND u.accountid=2"

The problem is that the order of operations is wrong. I'm getting users who aren't in account 2, making SQLFilter unreliable.



 Comments   
Comment by Fabio B. Silva [ 05/Nov/12 ]

Fixed : https://github.com/doctrine/doctrine2/commit/129d6efd8585458fd4bde2a3eb9a5cac374f54fe





[DDC-2121] EntityGenerator generates bad type hint (missing \) Created: 04/Nov/12  Updated: 09/Nov/12  Resolved: 06/Nov/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: 2.1, 2.2, 2.3
Fix Version/s: 2.3.1

Type: Bug Priority: Minor
Reporter: Stéphane Erard Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   

Having an Entity class with this property declaration :

/**
 * @ORM\OneToMany(targetEntity="Plan", mappedBy="Dossier")
 * @var Plan[]
 **/
protected $Plans;

Getter & Setter are generated this way :

/**
 * Add Plans
 *
 * @param se\JpsBundle\Entity\Plan $plans
 * @return Dossier
 */
public function addPlan(\se\JpsBundle\Entity\Plan $plans)
{
  $this->Plans[] = $plans;
  return $this;
}

Problem lies in the

@param se\JpsBundle\Entity\Plan $plans

Should be :

\se\JpsBundle\Entity\Plan $plans

Same thing for Doctrine Collection class.



 Comments   
Comment by Fabio B. Silva [ 06/Nov/12 ]

Fixed : https://github.com/doctrine/doctrine2/commit/262c3eea6bd4313d34558ff434bf9b8ff34b7ab3





[DDC-2080] Entity's association changes after first call Created: 15/Oct/12  Updated: 15/Oct/12  Resolved: 15/Oct/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.3
Fix Version/s: 2.3, 2.3.1
Security Level: All

Type: Bug Priority: Trivial
Reporter: Koby Soto Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

i am using the latest version of doctrine: 2.3

when you call a generated association function, the first time everything is fine:

$authors = $book->getBookToAuthors();
//$authors = array(5)
but the second time instead of returning the array of all associations it returns the last hydrated entity:

$authors = $book->getBookToAuthors();
//$authors = BookToAuthor entity
that happens even when there is nothing else happening:

$authors = $book->getBookToAuthors(); //will work
$authors = $book->getBookToAuthors(); //won't work
the function of getBookToAuthors() is:

public function getBookToAuthors()

{ return $this->bookToAuthors; }

and the mapping is as follows:

/**

  • @var BookToAuthor[]
    *
  • @OneToMany(targetEntity="BookToAuthor", mappedBy="book", cascade= {"persist"}

    )

  • @JoinColumn(name="id", referencedColumnName="book_id", onDelete="cascade")
    */
    private $bookToAuthors;
    please advise. i don't know what to do...


 Comments   
Comment by Koby Soto [ 15/Oct/12 ]

sorry sorry sorry
it was a mistake in the association target side.

the target had One-To-One association instead of Many-To-One





[DDC-2028] [GH-444] Fixed some tyo error in XML Exporter Created: 13/Sep/12  Updated: 05/Oct/12  Resolved: 05/Oct/12

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

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


 Description   

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

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

Message:






Generated at Wed Apr 23 15:32:56 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.