[DDC-2493] [GH-689] [WIP][DDC-1995 ] Support metadata class as parameter for instance of expression Created: 07/Jun/13  Updated: 07/Jun/13  Resolved: 07/Jun/13

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

Type: Bug Priority: Major
Reporter: Doctrine Bot 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/689

Message:

Hi guys,

This is a possible solution for DDC-1995(http://www.doctrine-project.org/jira/browse/DDC-1995),

I've attempted some diferent ways to fix this problem without success.
Anyway, RSM still looks like the wrong place to parameters mapping.



 Comments   
Comment by Doctrine Bot [ 07/Jun/13 ]

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

Comment by Fabio B. Silva [ 07/Jun/13 ]

Merged : https://github.com/doctrine/doctrine2/commit/462173ad71ae63cd9877e1e642f7968ed1f9971b





[DDC-2488] [GH-686] [DDC-2475] Replace OrderBy mapping when OrderByClause is given Created: 05/Jun/13  Updated: 05/Jun/13  Resolved: 05/Jun/13

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

Type: Bug Priority: Major
Reporter: Doctrine Bot 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/686

Message:

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



 Comments   
Comment by Doctrine Bot [ 05/Jun/13 ]

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

Comment by Fabio B. Silva [ 05/Jun/13 ]

Merged : https://github.com/doctrine/doctrine2/commit/753d63c2d48facdecba5d84f6ed2450024de2867





[DDC-2478] PersisterException when matching Criteria expression isNull to ArrayCollection Created: 30/May/13  Updated: 14/Jun/13  Resolved: 14/Jun/13

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

Type: Bug Priority: Major
Reporter: Antonio Trapani Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   
    /**
     * @ORM\ManyToOne(targetEntity="ClubBoardPost", inversedBy="children")
     * @var ClubBoardPost
     */
    protected $parent;

$criteria = Criteria::create()->where(Criteria::expr()->isNull('parent'));
$this->boardPosts->matching($criteria);

[output]
Cannot match on Fubles\CoreBundle\Entity\ClubBoardPost::parent with a non-object value. Matching objects by id is not compatible with matching on an in-memory collection, which compares objects by reference.

[first analysis]
@SqlExpressionVisitor:69 It seems like this check pretends that the value must be an object, maybe do you need to exclude NULL values only if association is nullable?



 Comments   
Comment by Fabio B. Silva [ 14/Jun/13 ]

Fixed : https://github.com/doctrine/doctrine2/commit/f2f1d8986c288a437b81cd756d889aa47880d8b8





[DDC-2475] ORDER BY on existing column is added, not replaced Created: 28/May/13  Updated: 05/Jun/13  Resolved: 05/Jun/13

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

Type: Bug Priority: Major
Reporter: Jeremy Livingston Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   

It seems that if an entity has an existing ORDER BY clause on a relation that any subsequent ORDER BYs on that field are added instead of replaced.

For example, I have two entities: Person and Membership. Person.Memberships has the following clause specified:

@ORM\OrderBy(

{"createDate" = "DESC"}

)

I also have a repository method that uses this relationship and sets the following DQL:

SELECT person, m
FROM \Company\Person person
JOIN person.memberships m
ORDER BY m.createDate ASC

I would expect this query to replace the existing ORDER BY with ORDER BY m.createDate ASC. Instead, it adds the ORDER BY to the existing one, which makes the end result: ORDER BY m.createDate ASC, m.createDate DESC.

This is obviously causing an issue since you can't sort by the same column in different order. Is this behavior by design? If so, is there a way to override the existing ORDER BY setting?



 Comments   
Comment by Fabio B. Silva [ 05/Jun/13 ]

Fixed : https://github.com/doctrine/doctrine2/commit/753d63c2d48facdecba5d84f6ed2450024de2867





[DDC-2470] Sql Server error in createQuery using ORDER BY and setMaxResults Created: 24/May/13  Updated: 07/Jun/13  Resolved: 07/Jun/13

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

Type: Bug Priority: Blocker
Reporter: Jonnatan Oyarzún Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: dql, sqlserver
Environment:

Windows 7, Apache 2 (xampp 1.8.1), PHP 5.4.7, Symfony 2.2.1


Attachments: PNG File BD.png    

 Description   

Important: This issue only affect to 2.4.* versions

When executing

$query = $em->createQuery('
SELECT m.nombre
     , m.fechainicio
     , m.fechafin 
  FROM Bundle:Medicion m
  JOIN m.estudio e
  JOIN e.cliente c
  JOIN c.usuarios u
 WHERE u.id = :id
 ORDER BY m.fechainicio DESC
')
->setMaxResults(12);

Get the following error:

An exception occurred while executing '
SELECT * 
  FROM (
           SELECT m0_.NOMBRE AS NOMBRE0
                , m0_.FECHAINICIO AS FECHAINICIO1
                , m0_.FECHAFIN AS FECHAFIN2
                , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum 
             FROM MEDICION m0_ WITH (NOLOCK) 
            INNER JOIN ESTUDIO e1_ 
               ON m0_.ESTUDIO_ID = e1_.ID 
            INNER JOIN CLIENTE c2_ 
               ON e1_.CLIENTE_ID = c2_.ID 
            INNER JOIN USUARIO u3_ 
               ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
       ) AS doctrine_tbl 
 WHERE doctrine_rownum BETWEEN 1 AND 12
' with params [2]:
SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.

Attached the BD model

Added extra info!

Engine version: Sql server 2008 R2

When executing this SQL (returned by doctrine error) on Management Studio

SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12

Get the following error:

El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)

But if change "FECHAINICIO1"

... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...

by this

... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...

Don't get error

regards
Jonnatan Oyarzún



 Comments   
Comment by Guilherme Blanco [ 05/Jun/13 ]
  • Which version of SQL Server are you working on?
  • Also, could you please verify 2 queries for us?
    This one should not work:
SELECT m0_.NOMBRE AS NOMBRE0
     , m0_.FECHAINICIO AS FECHAINICIO1
     , m0_.FECHAFIN AS FECHAFIN2 
  FROM MEDICION m0_ 
 ORDER BY FECHAINICIO1 DESC

This one should work:

SELECT m0_.NOMBRE AS NOMBRE0
     , m0_.FECHAINICIO AS FECHAINICIO1
     , m0_.FECHAFIN AS FECHAFIN2 
  FROM MEDICION m0_ 
 ORDER BY m0_.FECHAINICIO DESC

As soon as you get this it may define the approach on how we're gonna fix the issue. =)

Cheers,

Guilherme Blanco

Comment by Jonnatan Oyarzún [ 05/Jun/13 ]

Add extra info

Cheers,

Jonnatan Oyarzún

Comment by Fabio B. Silva [ 05/Jun/13 ]

Hi Jonnatan

There is a possible fix in this branch : DDC-2470,
but i'm not able to test it right now..

Could you please test it in your environment ?

Thanks..

Comment by Jonnatan Oyarzún [ 05/Jun/13 ]

Hi Fabio

Thank you very much for posting this fix.
From your DDC-2470, I downloaded and pasted files in vendor\doctrine\dbal.
Fix is working for me!.

The question is, when this fix could be merged to dbal/master branch?

Cheers,
Jonnatan Oyarzún

Comment by Fabio B. Silva [ 05/Jun/13 ]

Thanks Jonnatan,

I've created a pull request : https://github.com/doctrine/dbal/pull/332

Comment by Fabio B. Silva [ 07/Jun/13 ]

Fixed : https://github.com/doctrine/doctrine2/commit/753d63c2d48facdecba5d84f6ed2450024de2867





[DDC-2461] [GH-673] Namespace based command names Created: 17/May/13  Updated: 26/May/13  Resolved: 26/May/13

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: None


 Description   

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

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

Message:

Symfony console supports auto completion:
``orm:generate:entities`` could called ``o:g:e``



 Comments   
Comment by Doctrine Bot [ 17/May/13 ]

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

Comment by Marco Pivetta [ 17/May/13 ]

BC break without advantages

Comment by Doctrine Bot [ 17/May/13 ]

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

Comment by Doctrine Bot [ 26/May/13 ]

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





[DDC-2460] [GH-672] Simplification example Created: 17/May/13  Updated: 26/May/13  Resolved: 26/May/13

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

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


 Description   

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

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

Message:

Remove doctrine class loader, one bootstrap file



 Comments   
Comment by Doctrine Bot [ 26/May/13 ]

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





[DDC-2458] [GH-671] [DDC-2435] Fix column name with numbers and non alphanumeric characters. Created: 17/May/13  Updated: 17/May/13  Resolved: 17/May/13

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

Type: Bug Priority: Major
Reporter: Doctrine Bot 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/671

Message:

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



 Comments   
Comment by Doctrine Bot [ 17/May/13 ]

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

Comment by Fabio B. Silva [ 17/May/13 ]

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





[DDC-2457] [GH-670] [DDC-2451] Fix entity listeners serialization Created: 17/May/13  Updated: 17/May/13  Resolved: 17/May/13

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

Type: Bug Priority: Major
Reporter: Doctrine Bot 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/670

Message:

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



 Comments   
Comment by Doctrine Bot [ 17/May/13 ]

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

Comment by Fabio B. Silva [ 17/May/13 ]

merged : https://github.com/doctrine/doctrine2/commit/65886fdfeaf38692be5196a59530f56fc3e6ab56





[DDC-2456] [GH-669] Fixed generating column names for self referencing entity. Created: 17/May/13  Updated: 26/May/13  Resolved: 26/May/13

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

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


 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 26/May/13 ]

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





[DDC-2452] Additional `WITH` condition in joins between JTI roots cause invalid SQL to be produced Created: 16/May/13  Updated: 16/May/13

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

Type: Bug Priority: Major
Reporter: Marco Pivetta Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: dql, sql-walker
Environment:

irrelevant



 Description   

Given a simple Joined Table Inheritance like following:

/**
 * @Entity @Table(name="foo") @InheritanceType("JOINED")
 * @DiscriminatorColumn(name="discr", type="string")
 * @DiscriminatorMap({"foo" = "DDC2452Foo", "bar" = "DDC2452Bar"})
 */
class DDC2452Foo
{
    /** @Id @Column(type="integer") @GeneratedValue */
    public $id;
}

/** @Entity @Table(name="bar") */
class DDC2452Bar extends DDC2452Foo
{
}

Following DQL

SELECT foo1 FROM DDC2452Foo foo1 JOIN DDC2452Foo foo2 WITH 1=1

Will produce broken SQL:

SELECT
    f0_.id AS id0, f0_.discr AS discr1 
FROM 
    foo f0_ 
LEFT JOIN bar b1_ 
    ON f0_.id = b1_.id 
LEFT JOIN foo f2_ 
LEFT JOIN bar b3_ 
    ON f2_.id = b3_.id 
    ON (1 = 1)

(please note the duplicate `ON` in the SQL)

That is caused because of the SQL walker producing the JTI filter with already the `ON` clause in it.

That happens because the JTI join conditions are added in https://github.com/doctrine/doctrine2/blob/2.4.0-BETA2/lib/Doctrine/ORM/Query/SqlWalker.php#L823-L825 (`walkRangeVariableDeclaration`), while the additional defined `WITH` conditions are considered in `walkJoinAssociationDeclaration` later on.

Added a test case and fix at https://github.com/doctrine/doctrine2/pull/668






[DDC-2451] Entity listeners class don't work when metadatas are stored in cache Created: 16/May/13  Updated: 17/May/13  Resolved: 17/May/13

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

Type: Bug Priority: Major
Reporter: Bruno CHALOPIN Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: event, orm
Environment:

Ubuntu / PHP 5.4.9



 Description   

I'm using entity listeners class to make PostPersist and PostLoad actions per entity and use memcached as the metadata cache. Before the metadatas are in cache, the methods of the entity listeners are properly called but when the metadatas are in cache, they are no longer called. I've also made the test with APC and the result is the same.



 Comments   
Comment by Fabio B. Silva [ 17/May/13 ]

Fixed : https://github.com/doctrine/doctrine2/commit/65886fdfeaf38692be5196a59530f56fc3e6ab56





[DDC-2446] [GH-666] [DDC-2429] Fix xsd definition Created: 13/May/13  Updated: 26/May/13  Resolved: 26/May/13

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

Type: Bug Priority: Major
Reporter: Doctrine Bot 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/666

Message:

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



 Comments   
Comment by Doctrine Bot [ 26/May/13 ]

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





[DDC-2442] [GH-663] Adding failing test to demonstrate DDC-2432 Created: 09/May/13  Updated: 10/May/13  Resolved: 10/May/13

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

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


 Description   

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

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

Message:

Attempt to fix DDC-2432 ( http://www.doctrine-project.org/jira/browse/DDC-2432 )

Loading proxies with invalid identifiers will currently mark them as initialized regardless of the failure



 Comments   
Comment by Doctrine Bot [ 09/May/13 ]

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





[DDC-2441] Incorrect SQL Query being generated Created: 09/May/13  Updated: 07/Jun/13  Resolved: 07/Jun/13

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

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

Using Doctrine in Symfony 2.2.1 on Windows Platform



 Description   

The following DQL :

SELECT s,ba,c,mno,ss,sws,ccs,cns,cws FROM WLCoreBundle:SIM s INNER JOIN s.billingAccount ba LEFT JOIN s.connection c INNER JOIN s.status ss LEFT JOIN s.workflowStatus sws INNER JOIN c.customerStatus ccs INNER JOIN c.networkStatus cns LEFT JOIN c
.workflowStatus cws INNER JOIN s.mno mno ORDER BY c.msisdn ASC

Produces the following SQL :

SELECT * FROM (SELECT c0_.id AS id0, c0_.iccid AS iccid1, c0_.created AS created2, c0_.updated AS updated3, c0_.spreference AS spreference4, c1_.id ASid5, c1_.account_number AS account_number6, c1_.name AS name7, c1_.address1 AS address18, c1_.address2 AS address29, c1_.address3 AS address310, c1_.address4 AS address411, c1_.address5 AS address512, c1_.address6 AS address613, c1_.email_address AS email_address14, c1_.spreference AS spreference15, c2_.id AS id16, c2_.msisdn AS msisdn17, c2_.local AS local18, c2_.imsi AS imsi19, c2_.data AS data20, c2_.fax AS fax21, c2_.api AS api22, c2_.activation_date AS activation_date23, c2_.contract_end_date AS contract_end_date24, c2_.created AS created25, c2_.updated AS updated26, c2_.spreference AS spreference27, c3_.id AS id28, c3_.ident AS ident29, c3_.label AS label30, c3_.description AS description31, c4_.id AS id32, c4_.ident AS ident33, c4_.label AS label34, c4_.description AS description35, c4_.customer_label AS customer_label36, c4_.customer_description AS customer_description37, c5_.id AS id38, c5_.ident AS ident39, c5_.label AS label40, c5_.description AS description41, c6_.id AS id42, c6_.ident AS ident43, c6_.label AS label44, c6_.description AS description45, c7_.id AS id46, c7_.ident AS ident47, c7_.label AS label48, c7_.description AS description49, c7_.customer_label AS customer_label50, c7_.customer_description AS customer_description51, c8_.id AS id52, c8_.name AS name53, c8_.email_address AS email_address54, c8_.is_active AS is_active55, c8_.spreference AS spreference56, c0_.billing_account AS billing_account57, c0_.customerHierarchy AS customerHierarchy58, c0_.mno AS mno59, c0_.status AS status60, c0_.workflow_status AS workflow_status61, c1_.customer_hierarchy AS customer_hierarchy62, c1_.country AS country63, c1_.tax_rate AS tax_rate64, c1_.currency AS currency65, c1_.status AS status66, c1_.priority AS priority67, c2_.sim AS sim68, c2_.customer_status AS customer_status69, c2_.network_status AS network_status70, c2_.workflow_status AS workflow_status71, ROW_NUMBER() OVER (ORDER BY msisdn17 ASC) AS doctrine_rownum FROM core_sim c0_ WITH (NOLOCK) INNER JOIN core_billing_account c1_ ON c0_.billing_account = c1_.id LEFT JOIN core_connection c2_ ON c0_.id = c2_.sim INNER JOIN core_sim_status c3_ ON c0_.status = c3_.id LEFT JOIN core_sim_workflow_status c4_ ON c0_.workflow_status = c4_.id INNER JOIN core_connection_customer_status c5_ ON c2_.customer_status = c5_.id INNER JOIN core_connection_network_status c6_ ON c2_.network_status = c6_.id LEFT JOIN core_connection_workflow_status c7_ ON c2_.workflow_status = c7_.id INNER JOIN core_mno c8_ ON c0_.mno = c8_.id) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 10

Which returns an error :

SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid column name 'msisdn17'.

Same query works fine in Doctrine 2.3



 Comments   
Comment by Guilherme Blanco [ 05/Jun/13 ]

Which version of SQL Server are you using?

Comment by Guilherme Blanco [ 05/Jun/13 ]

Seems to be related to DDC-2470

Comment by Paul Mansell [ 05/Jun/13 ]

Im using SQL Server 2008 ... yes does seem the same / similar error

Comment by Fabio B. Silva [ 07/Jun/13 ]

Hi Paul Mansell

Could you please test this branch DDC-2470 with this fix in your environment ?

Thanks..

Comment by Fabio B. Silva [ 07/Jun/13 ]

Merged : https://github.com/doctrine/doctrine2/commit/753d63c2d48facdecba5d84f6ed2450024de2867

Comment by Fabio B. Silva [ 07/Jun/13 ]

Paul Mansell, please let us know if the problem continues after update





[DDC-2439] [GH-662] Fixed a code block. Created: 09/May/13  Updated: 09/May/13  Resolved: 09/May/13

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

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


 Description   

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

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

Message:

Last code block in the [Keeping your Modules independent](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/resolve-target-entity-listener.html) cookbook is broken.

Sphinx does not like the way code was indented. Building the documentation raises the following error:

en/cookbook/resolve-target-entity-listener.rst:121: ERROR: Unexpected indentation.



 Comments   
Comment by Doctrine Bot [ 09/May/13 ]

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





[DDC-2438] [GH-661] Update annotations-reference.rst Created: 09/May/13  Updated: 09/May/13  Resolved: 09/May/13

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

Type: Bug Priority: Major
Reporter: Doctrine Bot 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/661

Message:

Added missing @JoinColumns in the index



 Comments   
Comment by Doctrine Bot [ 09/May/13 ]

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





[DDC-2435] Column name with number and reserved character creates invalid query Created: 08/May/13  Updated: 17/May/13  Resolved: 17/May/13

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

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


 Description   

I have a column name called 1:1 which i map like so
@Column(type="string", name="`1:1`")
Unfortunately, the SQL that get generated does not work in mysql:
SELECT t0.`1:1` AS 112 FROM `table` t0
the problem is with the 'AS 112', if it contained a letter eg. 11a, or was escaped eg. `112` it wound work.



 Comments   
Comment by Fabio B. Silva [ 17/May/13 ]

Fixed : https://github.com/doctrine/doctrine2/commit/c9d9b68fa9937218aad05dfca4b3f96b409cfc8e





[DDC-2432] Entity can be initialized even if not found Created: 06/May/13  Updated: 09/May/13  Resolved: 09/May/13

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

Type: Bug Priority: Critical
Reporter: Christoph Roensch Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: None


 Description   

I have some data in loose consistency, trying to load a field from a certain entity will yield a EntityNotFoundException. Trying it again, for example if the group is reused in a set that gets iterated, will work but provide an empty/dirty Entity.

try {
  echo $item->getGroup()->getName();
} catch (\Doctrine\ORM\EntityNotFoundException $enfe) {
  // meh
}

Thats probably because the proxies internal methods set _isInitialized_ to true on the first try. Without reverting it in case of the exception...

    public function __load()
    {
        if (!$this->__isInitialized__ && $this->_entityPersister) {
            $this->__isInitialized__ = true;

            if ($this->_entityPersister->load($this->_identifier, $this) === null) {
                throw new \Doctrine\ORM\EntityNotFoundException();
            }
            unset($this->_entityPersister, $this->_identifier);
        }
    }

Is there any reason to do that?



 Comments   
Comment by Marco Pivetta [ 06/May/13 ]

That is specifically there to disallow recursive load operations that may occur - did you already try this with latest master?

Comment by Christoph Roensch [ 07/May/13 ]

I did not exactly use an "Doctrine Proxy". A colleque of me implemented his own proxies, wich instead of loading from an entity manager, load stuff from a webservice. He simply used the template that a normal proxy provided and thats where i found this case, throw exception - return initialized. Wich i found would be valid for real proxies too.

Now i tried to use http://www.doctrine-project.org/blog/doctrine-2-4-beta.html but the composer install just fails because common cant be resolved atm. So i downloaded and compiled all tarballs from github into our project. Now the proxy mechanism seems changed, with an _initializer_ closure instead. Our "Entities" in question won't work with that anymore...

I would have to construct a demo then, implementing real basic proxies with a RDBMS?

Comment by Marco Pivetta [ 07/May/13 ]

Christoph Roensch did you try setting the minimum-stability flag in composer? Give it a try again with 2.4 and ping back - proxies changed a lot since 2.3

Comment by Christoph Roensch [ 08/May/13 ]

I reproduced it with the tutorial application, please have a look at the two commits i made on https://github.com/croensch/doctrine2-orm-tutorial/tree/DDC-2432

Comment by Marco Pivetta [ 09/May/13 ]

Proposed a fix at https://github.com/doctrine/doctrine2/pull/663





[DDC-2430] Incorrect results when using ->matching on PersistentCollection Created: 05/May/13  Updated: 09/May/13  Resolved: 09/May/13

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

Type: Bug Priority: Major
Reporter: Stuart Carnie Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: criteria
Environment:

Ubuntu 12.04 LTS, PHP 5.4.14



 Description   

When using ->matching() on a PersistentCollection that is already loaded, it returns incorrect results when trying to match by id on a relationship.

// NOTE: the user property is a M:1 relationship of $entity
$c = new Criteria(Criteria::expr()->eq('user', $userId));
$res = $entity->getLikes()->matching($c);

// $res is empty, even if $userId exists



 Comments   
Comment by Benjamin Eberlei [ 09/May/13 ]

The problem is that matching a user by just the id doesn't work for in memory here.
You should use Criteria::expr()->eq('user', $user) instead. The ORM shouldnt allow $userId matching, but this is generic functionality we are reusing here, pretty hard to enforce this. I can take a look.

Comment by Benjamin Eberlei [ 09/May/13 ]

Fixed and introduced a BC break for this.

See https://github.com/doctrine/doctrine2/commit/30f90a6f49d46d2f367ac774aa77e0c7ce1a573f#L0R31 for information.





[DDC-2429] Association-Override Problem in XSD Mapping? Created: 05/May/13  Updated: 26/May/13  Resolved: 26/May/13

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

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   

From a mailinglist entry:

I use Doctrine 2.3 in Symfony 2.1.8

I'm using association-overrides in the XML format between several entities. Eclipse shows up several errors.

The first error message is shown in every Doctrine file when I declare the file format as such (for example: https://github.com/thewholelifetolearn/Social-Library/blob/master/src/SocialLibrary/ReadBundle/Resources/config/doctrine/GraphicNovel.orm.xml )

<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                  http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

Eclipse shows this error :
White spaces are required between publicId and systemId

The error points to the "doctrine-mapping" line

The second error comes up when I change the doctype to (file example: https://gist.github.com/thewholelifetolearn/5462057 ):

<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                  https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">

But then this error is shown:
cvc-complex-type.2.4.b: The content of element 'association-overrides' is not complete. One of '

{"http://doctrine-project.org/schemas/orm/doctrine-mapping":association-override, WC[##other:"http://doctrine-project.org/schemas/orm/doctrine-mapping"]}

' is expected.

The error points on "<association-overrides>" in Novel.orm.xml (line 8)

Could someone explain me the errors that show up? The first error doesn't seem to disturb Symfony2 but the second messes around the console commands. But it still generates the database.






[DDC-2419] [GH-655] [DDC-2409] Fix merge association UnitOfWork::STATE_NEW Created: 28/Apr/13  Updated: 01/May/13  Resolved: 01/May/13

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

Type: Bug Priority: Major
Reporter: Doctrine Bot 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/655

Message:

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



 Comments   
Comment by Doctrine Bot [ 01/May/13 ]

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





[DDC-2417] [GH-653] [DDC-2415] Fix CustomIdGenerator inheritance Created: 26/Apr/13  Updated: 27/Apr/13  Resolved: 27/Apr/13

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

Type: Bug Priority: Major
Reporter: Doctrine Bot 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/653

Message:

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



 Comments   
Comment by Doctrine Bot [ 27/Apr/13 ]

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





[DDC-2409] Merge operation tries to add new detached entities to indentity map and load them as proxies Created: 22/Apr/13  Updated: 05/May/13  Resolved: 01/May/13

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

Type: Bug Priority: Major
Reporter: Oleg Namaka Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   
class A
    {
       /**
        *  @ORM\ManyToOne(targetEntity= "B"...
        *  @ORM\JoinColumn(name=" ...
        */
        protected $b;
        
        public function getB()
        {
            return $this->b;
        }
        
        public function setB($b)
        {
            $this->b = $b;
        }
}
    
    class B
	{
       /**
        * As
        *
        * @var \Doctrine\Common\Collections\Collection
        *
        * @ORM\OneToMany(targetEntity="A", mappedBy="B")
        */
		protected $As;
    }
	
	$b = new \B();
	
	$a = $em->find('A', 123);
	
	$a->setB($b);
	
	$em->detach($a);
	
	$em->detach($b);
	
	$b = $em->merge($b); // notice that $b now is merged
	
	$a = $em->merge($a); //  hangs as it creates the proxy for $b and tries to load a though __load even though $b is already managed

Couple of possible issues in the following code from doMerge:

if ($assoc2['type'] & ClassMetadata::TO_ONE) {
                        $other = $prop->getValue($entity);
                        if ($other === null) {
                            $prop->setValue($managedCopy, null);
                        } else if ($other instanceof Proxy && !$other->__isInitialized__) {
                            // do not merge fields marked lazy that have not been fetched.
                            continue;
                        } else if ( ! $assoc2['isCascadeMerge']) {
                            if ($this->getEntityState($other, self::STATE_DETACHED) !== self::STATE_MANAGED) {
                                $targetClass = $this->em->getClassMetadata($assoc2['targetEntity']);
                                $relatedId = $targetClass->getIdentifierValues($other);

                                if ($targetClass->subClasses) {
                                    $other = $this->em->find($targetClass->name, $relatedId);
                                } else {
                                    $other = $this->em->getProxyFactory()->getProxy($assoc2['targetEntity'], $relatedId);
                                    $this->registerManaged($other, $relatedId, array());
                                }
                            }
                            $prop->setValue($managedCopy, $other);
                        }
     $relatedId = $targetClass->getIdentifierValues($other);

$relatedId is emply as the detached $other was never flushed. It should never be used to add this entity to the identityMap ($this->registerManaged($other, $relatedId, array())

$other = $this->em->getProxyFactory()->getProxy($assoc2['targetEntity'], $relatedId);

This should never use the proxy factory for new detached entities as they are already merged back ($b). This method seems to not have any means to find managed $b.

If $b = $em->merge($b); was not called, the method would probably have worked but I think it is not right to rely on that calling or not calling certain methods or their order.



 Comments   
Comment by Benjamin Eberlei [ 01/May/13 ]

Merged Fabios Pull Request

Comment by Oleg Namaka [ 01/May/13 ]

https://github.com/doctrine/doctrine2/pull/655





[DDC-2407] AbstractExporter _getIdGeneratorTypeString does not know about the UUID generator Created: 20/Apr/13  Updated: 20/Apr/13  Resolved: 20/Apr/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: 2.3.3
Fix Version/s: 2.4

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


 Description   

Shouldn't the AbstractExporter->_getIdGeneratorTypeString() method also know about the UUID generator ?



 Comments   
Comment by Benjamin Eberlei [ 20/Apr/13 ]

Fixed for 2.4





[DDC-2396] [GH-646] Oracle Pagination bug when ordering is present Created: 09/Apr/13  Updated: 14/Apr/13  Resolved: 14/Apr/13

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

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


 Description   

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

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

Message:

Please reference http://www.doctrine-project.org/jira/browse/DDC-1800 and http://www.doctrine-project.org/jira/browse/DDC-1958#comment-19969.



 Comments   
Comment by Doctrine Bot [ 10/Apr/13 ]

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





[DDC-2392] [GH-644] Fixed typos Created: 06/Apr/13  Updated: 06/Apr/13  Resolved: 06/Apr/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 pborreli:

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

Message:






[DDC-2390] Remove Parser and SQLWalker dependency on Query Created: 04/Apr/13  Updated: 04/Apr/13

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

Type: Improvement Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Query is too powerful to be available in Parser and SQLWalker, because it may lead to accessing data that changes on subsequent runs of a query that is cached.

Idea is to introduce a MetadataBag that contains only the values that are allowed to be accessed.






[DDC-2384] [GH-639] Added abillity to use metacolumn as indexBy Created: 02/Apr/13  Updated: 10/May/13  Resolved: 10/May/13

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

Type: Improvement 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/639

Message:

Added ability to use meta column as indexBy. Useful if association entities is widely used.
Replace #204 PR



 Comments   
Comment by Doctrine Bot [ 10/May/13 ]

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





[DDC-2369] [GH-630] Hotfix for DDC-2359 Created: 24/Mar/13  Updated: 24/Mar/13  Resolved: 24/Mar/13

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

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


 Description   

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

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

Message:

`Doctrine\ORM\Mapping\ClassMetadataFactory#wakeupReflection` is called twice as of DDC-2359



 Comments   
Comment by Benjamin Eberlei [ 24/Mar/13 ]

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

Comment by Benjamin Eberlei [ 24/Mar/13 ]

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





[DDC-2366] [GH-627] update document on Doctrine cache provider Created: 22/Mar/13  Updated: 24/Mar/13  Resolved: 24/Mar/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 chuanma:

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

Message:

A number of methods have been deleted long time ago. But they still show up on the document page.

http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/caching.html#deleting

http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/caching.html#counting

I checked source code. Most of the methods don't exist. They are better to be removed from the doc. I tried to use those functions and was surprised that they didn't exist.



 Comments   
Comment by Benjamin Eberlei [ 24/Mar/13 ]

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





[DDC-2360] [GH-622] Import EntityManager from proper namespace Created: 21/Mar/13  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 hrubi:

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

Message:



 Comments   
Comment by Benjamin Eberlei [ 21/Mar/13 ]

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





[DDC-2359] ClassMetadataFactory::wakeupReflection() is called twice Created: 20/Mar/13  Updated: 24/Mar/13  Resolved: 24/Mar/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers, ORM
Affects Version/s: Git Master, 2.3.2
Fix Version/s: 2.4

Type: Improvement Priority: Major
Reporter: Stefan Kleff Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: None


 Description   

ClassMetadataFactory::wakeupReflection() is called in Common\...\AbstractClassMetadataFactory::loadMetadata() at the end of the method. A few lines after that ORM\...\ClassMetadatafactory::doLoadMeadata() is called, where wakeupReflection() was already called. I think this has been overlooked during the refactoring of the factories. I think the call in doLoadMetadata() is redundant..



 Comments   
Comment by Marco Pivetta [ 24/Mar/13 ]

Fix at DDC-2369 - https://github.com/doctrine/doctrine2/pull/630





[DDC-2358] [GH-621] [doc] adding some more doc and examples for lifecycle event listeners and subscribers Created: 19/Mar/13  Updated: 06/Apr/13  Resolved: 06/Apr/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4

Type: Documentation Priority: Major
Reporter: Benjamin Eberlei Assignee: David Buchmann
Resolution: Fixed Votes: 0
Labels: None


 Description   

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

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

Message:

as requested in https://github.com/symfony/symfony-docs/pull/2301






[DDC-2356] [GH-619] [DDC-2090] Fix MultiTableUpdateExecutor with query cache Created: 17/Mar/13  Updated: 17/Mar/13  Resolved: 17/Mar/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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/619

Message:

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



 Comments   
Comment by Benjamin Eberlei [ 17/Mar/13 ]

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

Comment by Fabio B. Silva [ 17/Mar/13 ]

Merged : https://github.com/doctrine/doctrine2/commit/60b8bc63a1a4819cf112cfbbc7cca06b5792aba6





[DDC-2355] [GH-618] [DDC-2188] Fix arithmetic priority Created: 16/Mar/13  Updated: 06/Apr/13  Resolved: 06/Apr/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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/618

Message:

Hi guys,

This patch fix DDC-2188(http://www.doctrine-project.org/jira/browse/DDC-2188),
Not sure if it could be considered a BC break.

Cheers






[DDC-2345] convertObjectParameterToScalarValue() raises a notice Created: 12/Mar/13  Updated: 01/May/13  Resolved: 01/May/13

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

Type: Bug Priority: Minor
Reporter: Massimiliano Arione Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

In Doctrine\ORM\AbstractQuery.php, the method convertObjectParameterToScalarValue() can raise a Notice.
This code:

$value = $values[$class->getSingleIdentifierFieldName()];

should be changed in this one:

if (isset($values[$class->getSingleIdentifierFieldName()])) {
    $value = $values[$class->getSingleIdentifierFieldName()];
}


 Comments   
Comment by Marco Pivetta [ 12/Mar/13 ]

Massimiliano Arione the current DQL implementation doesn't allow you to bind composite key identifiers as parameters, thus you will never reach that piece of code.

A test would be needed for this case.

Comment by Massimiliano Arione [ 12/Mar/13 ]

Unfortunately, I'm not really a Doctrine guru.
I can tell you that I'm getting that notice, using Sortable behavior with Symfony2.
This is a partial error stack:

1 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 282

2 at ErrorHandler ->handle ('8', 'Undefined index: id', '(...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php', '282', array('value' => object(MyEntity), 'class' => object(ClassMetadata), 'values' => array()))

3 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 282
at AbstractQuery ->convertObjectParameterToScalarValue (object(MyEntity))

4 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 260
at AbstractQuery ->processParameterValue (object(MyEntity))

5 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php at line 285
at Query ->processParameterMappings (array('group__1' => array('0')))

6 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php at line 258
at Query ->_doExecute ()

7 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 737
at AbstractQuery ->execute (null, '1')

8 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 538
at AbstractQuery ->getResult ()

9 in (...)/vendor/gedmo/doctrine-extensions/lib/Gedmo/Sortable/SortableListener.php at line 410
at SortableListener ->getMaxPosition (object(EntityManager), object(ClassMetadata), array('position' => 'rank', 'groups' => array('my_entity'), 'useObjectClass' => 'Meeting\GestioneBundle\Entity\MyRelatedEntity'), object(MyRelatedEntity))

10 in (...)/vendor/gedmo/doctrine-extensions/lib/Gedmo/Sortable/SortableListener.php at line 114
at SortableListener ->prePersist (object(LifecycleEventArgs))

11 in (...)/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php at line 61
Comment by Marco Pivetta [ 12/Mar/13 ]

Massimiliano Arione having a composite primary key?

Comment by Massimiliano Arione [ 12/Mar/13 ]

Nope, just a plain "id".

Comment by Benjamin Eberlei [ 01/May/13 ]

Fixed in 2.4





[DDC-2334] [GH-602] Added $isIdentifierColumn documentation Created: 06/Mar/13  Updated: 12/Mar/13  Resolved: 12/Mar/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 alex88:

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

Message:

I've added the documentation of the argument $isIdentifierColumn since in case of foreign composite keys it doesn't��hydrate more then one row.



 Comments   
Comment by Benjamin Eberlei [ 12/Mar/13 ]

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





[DDC-2333] [GH-601] Add 'contains' comparison Created: 05/Mar/13  Updated: 12/Mar/13  Resolved: 12/Mar/13

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

Type: Improvement 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/601

Message:

As mentioned by @stof in doctrine/collections#5, the 'contains' comparison for matching collections should also be added to the ORM.

The first commit is only present in this PR because the doctrine/collections 1.0 release does not contain the recent addition. It should be removed/altered after a new version has been tagged, I think?



 Comments   
Comment by Benjamin Eberlei [ 12/Mar/13 ]

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





[DDC-2330] [GH-599] Removed unnecessary "<?php" from the docs Created: 03/Mar/13  Updated: 04/Mar/13  Resolved: 04/Mar/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 alexcarol:

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

Message:



 Comments   
Comment by Benjamin Eberlei [ 04/Mar/13 ]

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





[DDC-2327] [GH-596] Missing link to a cookbook in the docs Created: 01/Mar/13  Updated: 04/Mar/13  Resolved: 04/Mar/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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/596

Message:

The cookbook existed in the docs but there was no link to it in the docs.



 Comments   
Comment by Benjamin Eberlei [ 04/Mar/13 ]

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





[DDC-2326] [GH-595] Fixed broken code block in documentation Created: 01/Mar/13  Updated: 12/Mar/13  Resolved: 12/Mar/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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/595

Message:



 Comments   
Comment by Benjamin Eberlei [ 12/Mar/13 ]

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





[DDC-2320] [GH-591] Remove dead code Created: 26/Feb/13  Updated: 12/Mar/13  Resolved: 12/Mar/13

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

Type: Improvement 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 Aitboudad:

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

Message:






[DDC-2313] Deep clone for DBAL QueryBuilder Created: 21/Feb/13  Updated: 18/Jun/13  Resolved: 18/Jun/13

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

Type: Improvement Priority: Major
Reporter: Tim Mundt Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by DBAL-537 [GH-330] Cloning Resolved

 Description   

This is basically a duplicate of another issue I stumbled across lately but cannot find here again. It added a __clone() function to the ORM QueryBuilder to allow this use case:
Create a base query and derive two different queries from it.

I adopted the code for the DBAL QueryBuilder which is suffering the same issue (e.g. expressions were not cloned but shared between instances). The code is tested at least for my limited use case.

    /**
     * Deep clone of all expression objects in the SQL parts.
     *
     * @return void
     */
    public function __clone()
    {
        foreach ($this->sqlParts as $part => $elements) {
            if (is_array($this->sqlParts[$part])) {
                foreach ($this->sqlParts[$part] as $idx => $element) {
                    if (is_object($element)) {
                        $this->sqlParts[$part][$idx] = clone $element;
                    }
                }
            } else if (is_object($elements)) {
                $this->sqlParts[$part] = clone $elements;
            }
        }

        $params = array();

        foreach ($this->params as $param) {
            $params[] = clone $param;
        }

        $this->params = $params;
    }


 Comments   
Comment by Tim Mundt [ 03/Jun/13 ]

Thanks for adding the code tags. Just updated my doctrine to 2.4-RC1 and did not find this in there. Would be nice to see this in the new version. Any obstacles I could be of help with?

Comment by Marco Pivetta [ 03/Jun/13 ]

Tim Mundt, there's an open PR at https://github.com/doctrine/dbal/pull/327

Comment by Benjamin Eberlei [ 18/Jun/13 ]

Fixed in 2.4





[DDC-2312] [GH-586] Fix EntityManager doc Created: 21/Feb/13  Updated: 21/Feb/13  Resolved: 21/Feb/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 jsjohns:

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

Message:



 Comments   
Comment by Benjamin Eberlei [ 21/Feb/13 ]

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





[DDC-2311] ManyToManyPersister fails to delete when entity uses FK ID Created: 21/Feb/13  Updated: 16/Apr/13  Resolved: 16/Apr/13

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

Type: Bug Priority: Major
Reporter: Chris Richard Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   

ManyToManyPersister::getDeleteSQLParameters assumes $srcColumn contains a field name; doesn't handle association case.

ManyToManyPerister.php, lines 204-209:

// Composite identifier
$sourceClass = $this->_em->getClassMetadata($mapping['sourceEntity']);
foreach ($mapping['relationToSourceKeyColumns'] as $relColumn => $srcColumn) {
   $params[] = $identifier[$sourceClass->fieldNames[$srcColumn]];
}


 Comments   
Comment by Fabio B. Silva [ 21/Feb/13 ]

Hi Chris,

Could you try to add a failing test case please ?

Cheers.

Comment by Fabio B. Silva [ 16/Apr/13 ]

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





[DDC-2306] Lazy loading associated entity's property causes identity loss when another association is set to fetch="EAGER" Created: 20/Feb/13  Updated: 26/Feb/13  Due: 22/Feb/13  Resolved: 26/Feb/13

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

Type: Bug Priority: Critical
Reporter: William Schaller Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: orm, proxy, unitofwork
Environment:

PHP 5.4 - IIS 7.0


Attachments: Zip Archive sandbox-uow-issue.zip    

 Description   

There appears to be a bug in UnitOfWork.php, introduced in Merge pull request #406 from Ocramius/DCOM-96. The relevant section is lines 2479-2495.

In the attached test sandbox, there are 4 entities.

User and Address have a many-many relationship via UserAddress – this more or less duplicates what I have in my actual application. There is another entity that both User and Address refer to in a one-to-many relationship – Zone.

When the Zone relationship on User and Address is set to fetch="LAZY", the problem is absent. When the relationship is set to fetch="EAGER", the problem manifests as such:

When I load a User via $em->find(), and then access properties on a related Address, the identity of the Address is lost. The same is true going in the other direction. I var_dump the Address before accessing its street property, and it shows up properly as an uninitialized proxy with just the id set. After I access the street property of the Address, var_dump shows the proxy is loaded and initialized, with all properties set except the identity, which is now null.

I stepped through the code using XDebug, and found that the referenced lines in UnitOfWork.php are setting the created Address entity's properties incorrectly, removing the identity from the generated entity. It seems to have something to do with the _hints parameter.

I'm not sure what the fix is, because I am not familiar enough with this part of the code and what it is intended to do. I assume that this is not intended behavior.

I've included my test case sandbox, which references ../../../../autoload.php to load Doctrine. This was tested against doctrine2/master as of today.



 Comments   
Comment by Marco Pivetta [ 21/Feb/13 ]

I've created a branch with a fix at https://github.com/Ocramius/doctrine2/compare/hotfix;DDC-2306

Basically, what was happening here is a really nasty one:

The UnitOfWork did consider the `Zone` entity as if it was a `User` entity (not comparing classnames, basically). Since the identifier was also the same in this case, the two entities were compared as if the newly loaded `Zone` had to replace the existing `User` proxy.

Thus, the proxy was marked as un-managed and trashed (and so the identifier was also nulled).

Please pull the branch and give it a try. I'll re-read it tomorrow and then open a PR.

Comment by William Schaller [ 21/Feb/13 ]

This fixes the problem for the test case and for my app. Excellent speedy fix, thanks

Comment by Benjamin Eberlei [ 21/Feb/13 ]

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

Comment by Benjamin Eberlei [ 26/Feb/13 ]

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





[DDC-2304] [GH-583] accept more than 2 parameters in CONCAT function Created: 19/Feb/13  Updated: 12/Mar/13  Resolved: 12/Mar/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 broncha:

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

Message:

The DBAL Platform supports more then 2 parameters but the ConcatFunction only validates 2 parameters to CONCAT. This commit allows to pass more than 2 parameters to CONCAT. Also this change would require that `getConcatExpression` accept array as a parameter. I have opened a pull request for that as well.






[DDC-2294] [GH-579] Unit tests: cleanup of outdated / unused / commented out code Created: 12/Feb/13  Updated: 12/Mar/13  Resolved: 12/Mar/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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/579

Message:

Many methods in unit tests were unused, in particular in mocks, where methods overriding in the past were not overriding anything anymore.

Some commented out code was referring to features that seem to have been removed years ago, so I removed it as well.

`HydratorMockStatement::bindParam()` was adding extra parameter that its parent did not define, and that were never used, so I removed them as well.






[DDC-2291] [GH-576] Update docs/en/reference/batch-processing.rst Created: 08/Feb/13  Updated: 11/Feb/13  Resolved: 11/Feb/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 acasademont:

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

Message:

If you have only $batchSize - 1 rows (amongst other cases), the entities are never flushed, you need a final flush outside the loop.

In the bulk insert you should also need a final flush if the number of entities inserted is not a multiple of the $batchSize.



 Comments   
Comment by Benjamin Eberlei [ 11/Feb/13 ]

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





[DDC-2289] [GH-575] Added YAML configuration example for "Simple Derived Identity" in Docs Created: 08/Feb/13  Updated: 11/Feb/13  Resolved: 11/Feb/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 naitsirch:

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

Message:

I have added a missing YAML configuration example to the tutorial. Because I needed it for myself

See http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/composite-primary-keys.html#use-case-2-simple-derived-identity

I hope the YAML definition is correct.



 Comments   
Comment by Benjamin Eberlei [ 11/Feb/13 ]

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





[DDC-2276] [GH-569] Hotfix/pre flush event args params Created: 04/Feb/13  Updated: 12/Feb/13  Resolved: 12/Feb/13

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

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


 Description   

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

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

Message:

As reported by a user on IRC, the `PreFlushEventArgs` object was built with incorrect parameters. this fix solves the problem by typehinting the constructor.

Tests aren't really necessary since a lot of functional tests were simply broken because of this additional typehint.



 Comments   
Comment by Benjamin Eberlei [ 12/Feb/13 ]

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

Comment by Fabio B. Silva [ 12/Feb/13 ]

Merged : https://github.com/doctrine/doctrine2/commit/719031f2effd2074d94c709b6b7311fb0773fb7f





[DDC-2274] [GH-567] Removed outdated methods in DatabasePlatformMock Created: 03/Feb/13  Updated: 05/Feb/13  Resolved: 05/Feb/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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/567

Message:

`DatabasePlatformMock::getNativeDeclaration()` and `getPortableDeclaration()` do not override an existing method in `AbstractPlatform`.
I guess they are leftovers of a previous version, and should be removed.



 Comments   
Comment by Benjamin Eberlei [ 03/Feb/13 ]

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

Comment by Fabio B. Silva [ 05/Feb/13 ]

merged : https://github.com/doctrine/doctrine2/commit/ef1ed588b5db6f87399772f953bf8b6dc4d2556d





[DDC-2273] [GH-566] Added missing return statement to AbstractCommand. Created: 03/Feb/13  Updated: 05/Feb/13  Resolved: 05/Feb/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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/566

Message:

The `AbstractCommand::execute()` method should return an `integer`, or `null`.

Although in PHP, omitting the `return` statement is equivalent to returning `null`, it is recommended to put an explicit `return` to clearly differentiate it from `return void`.

I've added `return 0;` here, keeping the existent behavior.



 Comments   
Comment by Benjamin Eberlei [ 03/Feb/13 ]

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

Comment by Fabio B. Silva [ 05/Feb/13 ]

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





[DDC-2272] [GH-565] Removed an unused local variable. Created: 03/Feb/13  Updated: 05/Feb/13  Resolved: 05/Feb/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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/565

Message:

This PR removes an unused (redundant) local variable declaration.



 Comments   
Comment by Benjamin Eberlei [ 03/Feb/13 ]

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

Comment by Fabio B. Silva [ 05/Feb/13 ]

Merged : https://github.com/doctrine/doctrine2/commit/114827a4b32fe309519cf3f9bdfedb3599d52f37





[DDC-2268] Lexer error using string functions inside CASE WHEN Created: 02/Feb/13  Updated: 02/Feb/13  Resolved: 02/Feb/13

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

Type: Bug Priority: Major
Reporter: Stefano Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: dql
Environment:

Windows 8 64bit, IIS Express 8, PHP 5.4.9



 Description   

When using the CASE WHEN expression in DQL a Lexer error is thrown if the THEN condition uses a FunctionsReturningStrings function. For example, the following query is valid in SQL:

SELECT t.*, CASE WHEN LENGTH(t.myfield) <> 0 THEN CONCAT(t.myfield, t.myfield2) ELSE t.myfield2 END as mycasefield FROM mytable AS t

However, if the CONCAT function is used in DQL the exception is raised.



 Comments   
Comment by Fabio B. Silva [ 02/Feb/13 ]

https://github.com/doctrine/doctrine2/commit/1627fc95965a3e2e3894fcf7e524eb0eaa9d0ddd





[DDC-2266] [GH-562] Fix error in QueryBuilder example Created: 30/Jan/13  Updated: 05/Feb/13  Resolved: 05/Feb/13

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

Type: Documentation Priority: Trivial
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 vrana:

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

Message:



 Comments   
Comment by Benjamin Eberlei [ 02/Feb/13 ]

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

Comment by Fabio B. Silva [ 05/Feb/13 ]

Merged : https://github.com/doctrine/doctrine2/commit/4651d92d634784d5d8d02af378afccb74935058c





[DDC-2265] [GH-561] fix typo in the documentation Created: 30/Jan/13  Updated: 05/Feb/13  Resolved: 05/Feb/13

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

Type: Documentation 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 ftdebugger:

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

Message:



 Comments   
Comment by Benjamin Eberlei [ 02/Feb/13 ]

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

Comment by Fabio B. Silva [ 05/Feb/13 ]

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





[DDC-2256] [GH-554] Fixed ObjectHydrator when namespace alias is given. Created: 24/Jan/13  Updated: 05/Feb/13  Resolved: 05/Feb/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 beregond:

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

Message:

Fixes problem when executing native query:
```php
$rsm = new ResultSetMapping();

$rsm->addEntityResult('DbBundle:Player', 'p');
$rsm->addFieldResult('p', 'id', 'id');
$rsm->addFieldResult('p', 'name', 'name');

$rsm->addJoinedEntityResult('DbBundle:User', 'u', 'p', 'user');
$rsm->addFieldResult('u', 'user_id', 'id');

$em->createNativeQuery('...', $rsm);
```

Hydrator couldn't find cached metadata, when "joined entity result" class name wasn't fully qualified name (as in the example above).



 Comments   
Comment by Benjamin Eberlei [ 02/Feb/13 ]

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

Comment by Fabio B. Silva [ 05/Feb/13 ]

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





[DDC-2252] Trying to delete ManyToMany relatrionship with composite keys. Created: 22/Jan/13  Updated: 16/Apr/13  Resolved: 16/Apr/13

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

Type: Bug Priority: Major
Reporter: Jeremie Tom tom Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None
Environment:

Debian
PHP 5.3.7


Attachments: File AdvancedAssociationTest.php     Text File jira-doctrine.txt     File patch.diff    

 Description   

Hi,

When i try to delete some entities attached to an entity I've got the following message.

My entity is specified as follow.

    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="Entity\User\Account", inversedBy="memberships")
     * @ORM\JoinColumn(name="uid", referencedColumnName="uid")
     */
    protected $userAccount;

    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="Entity\Merchant\Account")
     * @ORM\JoinColumn(name="mch_accountid", referencedColumnName="accountid")
     */
    protected $merchantAccount;

    /**
     * @ORM\Column(type="datetime", name="date")
     * @var datetime
     */
    protected $date;

    /**
     * @ORM\Column(type="boolean")
     * @var boolean
     */
    protected $administrator;

    /**
     * @ORM\ManyToMany(targetEntity="Entity\User\Privilege", indexBy="privilegeid")
     * @ORM\JoinTable(name="fsbackend.user_mch_account_privilege",
     *   joinColumns={
     *       @ORM\JoinColumn(name="mch_accountid", referencedColumnName="mch_accountid"),
     *       @ORM\JoinColumn(name="uid", referencedColumnName="uid")
     *   },
     *   inverseJoinColumns={
     *       @ORM\JoinColumn(name="privilegeid", referencedColumnName="privilegeid")
     *   }
     * )
     */
    protected $privileges;

I delete the related entities

    $membership->getPrivileges()->clear();

    $this->_em->persist($userAccount);
    $this->_em->flush();

I tried on doctrine 2.1.7 and the last doctrine version and same thing happens.

Please find attached the error log.



 Comments   
Comment by Marco Pivetta [ 22/Jan/13 ]

Jeremie Tom tom is the schema validated by the cli tools?

Comment by Jeremie Tom tom [ 22/Jan/13 ]

Yes it's validated by the cli tools, if you are talking about the orm:validate-schema command.

Comment by Jeremie Tom tom [ 23/Jan/13 ]

I think the problem is that my @Id are entities.

Comment by Marco Pivetta [ 23/Jan/13 ]

Jeremie Tom tom can you abstract it away into a test?

Comment by Jeremie Tom tom [ 23/Jan/13 ]

Here is my test case.

I put it IN Doctrine\Test\ORMJT.
I don't really know if you need something else, please let met know.

<?php

namespace Doctrine\Tests\ORMJT;

use Doctrine\ORM\Query;
use Doctrine\Common\Collections\ArrayCollection;

require_once __DIR__ . '/../TestInit.php';

/**
 * Functional tests for the Single Table Inheritance mapping strategy.
 *
 * @author robo
 */
class AdvancedAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase
{
    protected function setUp() {
        parent::setUp();
        try {
            $this->_schemaTool->createSchema(array(
                $this->_em->getClassMetadata('Doctrine\Tests\ORMJT\User'),
                $this->_em->getClassMetadata('Doctrine\Tests\ORMJT\MerchantAccount'),
                $this->_em->getClassMetadata('Doctrine\Tests\ORMJT\Membership'),
                $this->_em->getClassMetadata('Doctrine\Tests\ORMJT\Privilege')
            ));
        } catch (\Exception $e) {
            // Swallow all exceptions. We do not test the schema tool here.
        }
    }

    public function testIssue()
    {
        $user = new User;
        $merchantAccount = new MerchantAccount;
        $privilege = new Privilege;
        $membership = new Membership($user, $merchantAccount);
        $membership->addPrivilege($privilege);

        $this->_em->persist($user);
        $this->_em->persist($merchantAccount);
        $this->_em->persist($privilege);
        $this->_em->flush();

        $this->_em->persist($membership);
        $this->_em->flush();

        $membership->getPrivileges()->clear();

        $this->_em->flush();

        // Never reached
        $this->assertTrue(true);
    }
}


/**
 * @Entity
 * @Table(name="mch_account")
 */
class MerchantAccount
{
    /**
     * @Id @GeneratedValue
     * @Column(type="bigint")
     * @var bigint $accountid
     */
    protected $accountid;
}

/**
 * @Entity(repositoryClass="Repository\User\PrivilegeRepository")
 * @Table(name="acl_privilege")
 */
class Privilege
{
    /**
     * @Id @GeneratedValue
     * @Column(type="bigint")
     * @var integer
     */
    protected $privilegeid;
}

/**
 * @Entity
 * @Table(name="user_account")
 */
class User {
    /**
     * @Id @GeneratedValue
     * @Column(type="bigint")
     * @var integer
     */
    protected $uid;

    /**
     * @OneToMany(targetEntity="Membership", mappedBy="userAccount", cascade={"persist"})
     * @JoinColumn(name="uid", referencedColumnName="uid")
     */
    protected $memberships;

    public function __construct()
    {
        $this->memberships = new ArrayCollection;
    }

    public function getMemberships()
    {
        return $this->memberships;
    }

    public function addMembership(Membership $membership)
    {
        $this->memberships[] = $membership;
    }
}

/**
 * @Entity
 * @Table(name="mch_account_member")
 * @HasLifecycleCallbacks
 */
class Membership
{
    /**
     * @Id
     * @ManyToOne(targetEntity="User", inversedBy="memberships")
     * @JoinColumn(name="uid", referencedColumnName="uid")
     */
    protected $userAccount;

    /**
     * @Id
     * @ManyToOne(targetEntity="MerchantAccount")
     * @JoinColumn(name="mch_accountid", referencedColumnName="accountid")
     */
    protected $merchantAccount;

    /**
     * @ManyToMany(targetEntity="Privilege", indexBy="privilegeid")
     * @JoinTable(name="user_mch_account_privilege",
     *   joinColumns={
     *       @JoinColumn(name="mch_accountid", referencedColumnName="mch_accountid"),
     *       @JoinColumn(name="uid", referencedColumnName="uid")
     *   },
     *   inverseJoinColumns={
     *       @JoinColumn(name="privilegeid", referencedColumnName="privilegeid")
     *   }
     * )
     */
    protected $privileges;

    public function __construct(User $user, MerchantAccount $merchantAccount)
    {
        $this->userAccount = $user;
        $this->merchantAccount = $merchantAccount;
        $this->privileges = new ArrayCollection();
    }

    public function addPrivilege($privilege)
    {
        $this->privileges[] = $privilege;
    }

    public function getPrivileges()
    {
        return $this->privileges;
    }
}

And i've got the following error

1) Doctrine\Tests\ORMJT\AdvancedAssociationTest::testIssue
Exception: [PHPUnit_Framework_Error_Notice] Undefined index: mch_accountid
Comment by Marco Pivetta [ 23/Jan/13 ]

Thank you so far, this makes it much easier to work with it!

Comment by Jeremie Tom tom [ 26/Jan/13 ]

Interesting fact, if I only have one column in my jointable it works fine.

eg.

class Membership
     *   ....
     *   @JoinTable(name="user_mch_account_privilege",
     *       joinColumns={
     *           @JoinColumn(name="uid", referencedColumnName="uid")
     *       }
     *   ....
Comment by Jeremie Tom tom [ 07/Feb/13 ]

Ok here is my two cents solution. passes the tests.

Comment by Jeremie Tom tom [ 05/Mar/13 ]

Hi, any update on this issue?

Comment by Marco Pivetta [ 05/Mar/13 ]

Jeremie Tom tom will be checking this tomorrow

Comment by Jeremie Tom tom [ 14/Mar/13 ]

Everything ok with the check?

Comment by Fabio B. Silva [ 16/Apr/13 ]

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





[DDC-2247] [GH-551] [DDC-2234] FUNCTION() IS NULL comparison Created: 19/Jan/13  Updated: 20/Jan/13  Resolved: 20/Jan/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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/551

Message:

This patch fix DDC-2234:
http://www.doctrine-project.org/jira/browse/DDC-2234



 Comments   
Comment by Benjamin Eberlei [ 20/Jan/13 ]

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





[DDC-2234] WHERE <<custom function>> IS NULL ... doesn't work Created: 11/Jan/13  Updated: 20/Jan/13  Resolved: 20/Jan/13

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

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


 Description   

I want to run this query :

SELECT ifnull(a.field1, a.field1) as name FROM table a WHERE ifnull(a.field1, a.field1) IS NULL

But I get an doctrine exception :

Doctrine\ORM\Query\QueryException' with message '[Syntax Error] line 0, col 518: Error: Expected Doctrine\ORM\Query\Lexer::T_IS, got '('' in /library/Doctrine/ORM/Query/QueryException.php:52

If I don't use the IS NULL in my where clause it is working perfectly.

I think this issue is related to :
http://www.doctrine-project.org/jira/browse/DDC-1472






[DDC-2215] [GH-543] Make doctrine a Light-weight distribution package in Composer Created: 28/Dec/12  Updated: 19/Jan/13  Resolved: 19/Jan/13

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

Type: Improvement 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 carlosbuenosvinos:

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

Message:

In order to save space and bandwidth when installing doctrine using Composer, I have added .gitattributes removing files and folders unnecessary when using doctrine as a dependecy.

(extracted from http://getcomposer.org/doc/02-libraries.md#light-weight-distribution-packages)

Including the tests and other useless information like .travis.yml in distributed packages is not a good idea.

The .gitattributes file is a git specific file like .gitignore also living at the root directory of your library. It overrides local and global configuration (.git/config and ~/.gitconfig respectively) when present and tracked by git.

Use .gitattributes to prevent unwanted files from bloating the zip distribution packages.

// .gitattributes
/Tests export-ignore
phpunit.xml.dist export-ignore
Resources/doc/ export-ignore
.travis.yml export-ignore
Test it by inspecting the zip file generated manually:

git archive branchName --format zip -o file.zip

Note: Files would be still tracked by git just not included in the distribution. This will only work for GitHub packages installed from dist (i.e. tagged releases) for now.






[DDC-2214] extra single quotation in sql when using EntityRepository::findBy Created: 26/Dec/12  Updated: 12/Jun/13  Resolved: 12/Jun/13

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

Type: Bug Priority: Major
Reporter: scourgen Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: None

Attachments: File DDC2214Test.php    

 Description   

I'm using symfony 2.1 with mysql.

I have following code:

$related = 
$this->getDoctrine()->getRepository('MyWebBundle:LineRelated')
->findBy(array('line' => $lines), array('count' => 'DESC'), 20);

that generate the sql like this:

SELECT *
FROM line_related t0 
WHERE t0.line_id IN ('6059', 126352, '5677', '6058') 
ORDER BY t0.count DESC 
LIMIT 20

please notice that the sql has extra single quotation around the number 6059,5677 and 6058. which make the sql very slow.

I did a test, when using single quotation,the sql takes 300ms,when using without single quotation,the sql takes 1 ms.



 Comments   
Comment by Fabio B. Silva [ 26/Dec/12 ]

Hi

Could you please attach your entities or a failing test case ?

Cheers

Comment by scourgen [ 27/Dec/12 ]

sure

LineRelated.php :

class LineRelated
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
     protected $id;

    /**
     * @ORM\ManyToOne(targetEntity="Line", inversedBy="line_related")
     * @ORM\JoinColumn(name="line_id", referencedColumnName="id",nullable=false)
     */
     protected $line;
     
    /**
     * @ORM\Column(name="line_id_related", type="integer")
     */
    protected $line_related;

    /**
     * @ORM\Column(type="smallint",nullable=false)
     */
     protected $count = 0;

###### get/set etc....... #######

Line.php

class Line
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
########## blablabla #############

my action:

    public function right_line_relatedAction($line = null, $title='相关线路')
    {

        $lines = $l->getByUser($user, array());
//anyway,$lines is an array,It has several elements,each element is an instance of LineEntity.

        $related = $this->getDoctrine()->getRepository('MyWebBundle:LineRelated')->findBy(array('line' => $lines), array('count' => 'DESC'), 20);
//this findBy function generate the sql which is slow.

        return $related;
    }
Comment by Fabio B. Silva [ 27/Dec/12 ]

Hi,

How did you get this query string ?

Repository#findBy does not quote the values, It uses PDO:bindParam.
so the expected query string should be someting like :

WHERE t0.line_id IN (?, ? ,?) 

I tried to reproduce but in my tests the generated Query binds the parameters as "PDO::PARAM_INT".

I have added a test case.
Could you please can try to change it and make fails.

Cheers

Comment by scourgen [ 28/Dec/12 ]

reproduced :

SELECT t0.id AS id1, t0.line_id_related AS line_id_related2, t0.count AS count3, t0.line_id AS line_id4 FROM line_related t0 WHERE t0.line_id IN ('6059', 4851, '6068', 126352, '6060', '1000000') ORDER BY t0.count DESC LIMIT 20
Parameters: [['6059', 4851, '6068', 126352, '6060', '1000000']] 
[Hide runnable query]
Time: 234.53 ms [   Explain query ]

let me have a look on what's going on

Comment by scourgen [ 28/Dec/12 ]

interesting. I've dump(using ladybug_dump) the $lines,and I found out that when the element is a Proxies Object(Object(Proxies_GC_\My\WebBundle\Entity\Line)),then the id of that Object will be with quoted,when the elememt is an Real Entity,then It will be without quote.

for example,in my last comment, the parameters is [['6059', 4851, '6068', 126352, '6060', '1000000']]
the result of dumping $lines is :

array(6)
[0]: object(Proxies_CG_\Zuo\WebBundle\Entity\Line)
[1]: object(Zuo\WebBundle\Entity\Line)
[2]: object(Proxies_CG_\Zuo\WebBundle\Entity\Line)
[3]: object(Zuo\WebBundle\Entity\Line)
[4]: object(Proxies_CG_\Zuo\WebBundle\Entity\Line)
[5]: object(Proxies_CG_\Zuo\WebBundle\Entity\Line)

tell me if you need more information. thanks

Comment by Marco Pivetta [ 28/Dec/12 ]

This may be because

$_identifier

in proxies ( https://github.com/doctrine/doctrine2/blob/42e83a2716d19eada4f1cd49ece77d5f5229a239/lib/Doctrine/ORM/Proxy/ProxyFactory.php#L383 ) is not necessarily composed by integers. This could be fixed with DCOM-96. I'll add the tests to my development branch and will ping you back tomorrow

Comment by scourgen [ 28/Dec/12 ]

thanks

Comment by Marco Pivetta [ 06/Jan/13 ]

I see what is going on here... But this should not be a problem anyway, since they're bound anyway as "PDO::PARAM_INT", as Fabio B. Silva told you.

That's only a problem with the logger showing them as string. PDO will handle the conversion before the value hits the DB as far as I know.

Comment by scourgen [ 07/Jan/13 ]

I can understand your point,but what I don't really get is that the execute time of sql is very long,that explained the quote should be in the sql,not like what you said,that's only a problem with the logger.

Comment by Marco Pivetta [ 07/Jan/13 ]

scourgen can you profile the difference directly in CLI? What about checking the bound parameter type? Are those values bound as INTs in your case?

Comment by scourgen [ 07/Jan/13 ]

@ocramius I wish I could, but I was using doctrine2 with symfony2,So It looks like It will takes some time to simulating all environment and settings that could allow me to reproduced the problem.

but anyway,I will have a try and tell you what happen when I found something.

Comment by Marco Pivetta [ 07/Jan/13 ]

scourgen ok, awaiting your reply then

Comment by scourgen [ 07/Jan/13 ]

I've spent some time on playing with native doctrine2. It took me awhile to setup everything. but I just don't get that how to retrive data with its Proxy ojbect(for example Proxies_CG_\My\WebBundle\Entity\Line).

I mean the result of

$this->_em->getRepository("something")->findxxx()

always return an array of real object. I can't reproduced the situation(#comment-19186) that happens on symfony2+doctrine2.

anyway,I can make sure the problem is real exist,Because the execute time of that slow sql from the tool bar of symfony2 is same as I executed it at mysql cli. If the sql shows up on log with quote but running at mysql without quote,the execute time won't be same(actually It will be much more faster,in my case,20x times,from 2xxms to 10ms).

Comment by Marco Pivetta [ 07/Jan/13 ]

scourgen you can use

$em->getReference($className, $identifier)

(identifier being a key=>value array) to force proxies.

Give it a try

Comment by scourgen [ 08/Jan/13 ]

looks like I reproduced it.

    public function testIssue()
    {   
         $no_used=   $this->_em->getRepository(__NAMESPACE__. '\DDC2214Line')->findOneById(1);
        $lines=array(
            //$this->_em->getRepository(__NAMESPACE__. '\DDC2214Line')->findOneById(1),
            $this->_em->getReference(__NAMESPACE__. '\DDC2214Line',1),
            $this->_em->getReference(__NAMESPACE__. '\DDC2214Line','2'),
            $this->_em->getReference(__NAMESPACE__. '\DDC2214Line',3),
        );  
        $logger  = $this->_em->getConnection()->getConfiguration()->getSQLLogger();
        $ids     = array_map(function($r){
            return $r->id;
        }, $this->relatedList);

        //$related = $this->_em->getRepository(__NAMESPACE__ . '\DDC2214LineRelated')->findBy(array('line' => $lines), array('count' => 'DESC'), 20);
        $related = $this->_em->createQuery('select lr from '.__NAMESPACE__ . '\DDC2214LineRelated lr where lr.id in (:ids)')->setParameter('ids',$lines)->getResult();
            
        $query   = end($logger->queries);
//\Doctrine\Common\Util\Debug::dump($query['params']);

        $this->assertCount(3, $related);
        $this->assertEquals($ids, $query['params'][0]);
        $this->assertEquals(\Doctrine\DBAL\Connection::PARAM_INT_ARRAY, $query['types'][0]);
    }   
}

I use MySql Query log to see what's really happen in database(http://dev.mysql.com/doc/refman/5.5/en/query-log.html)

this is the log from table mysql.general_log

2013-01-08 12:23:44	[root] @ localhost [127.0.0.1]	59	0	Connect	root@localhost on doctrine_tests
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	CREATE TABLE DDC2214Line (id INT AUTO_INCREMENT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	CREATE TABLE DDC2214LineRelated (id INT AUTO_INCREMENT NOT NULL, line_id INT NOT NULL, count SMALLINT NOT NULL, line_id_related INT NOT NULL, INDEX IDX_D31307994D7B7542 (line_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	ALTER TABLE DDC2214LineRelated ADD CONSTRAINT FK_D31307994D7B7542 FOREIGN KEY (line_id) REFERENCES DDC2214Line (id)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	START TRANSACTION
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	INSERT INTO DDC2214Line (id) VALUES (null)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	INSERT INTO DDC2214Line (id) VALUES (null)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	INSERT INTO DDC2214Line (id) VALUES (null)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	INSERT INTO DDC2214LineRelated (count, line_id_related, line_id) VALUES (1, 1, 1)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	INSERT INTO DDC2214LineRelated (count, line_id_related, line_id) VALUES (2, 2, 2)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	INSERT INTO DDC2214LineRelated (count, line_id_related, line_id) VALUES (3, 3, 3)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	COMMIT
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	SELECT t0.id AS id1 FROM DDC2214Line t0 WHERE t0.id = 1 LIMIT 1
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	SELECT d0_.id AS id0, d0_.count AS count1, d0_.line_id_related AS line_id_related2, d0_.line_id AS line_id3 FROM DDC2214LineRelated d0_ WHERE d0_.id IN (1, '2', 3)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Quit	

you can see,in database level,the second parameter of last query but two has quote ( (1, '2', 3) )

Comment by Benjamin Eberlei [ 25/Jan/13 ]

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

Comment by Benjamin Eberlei [ 26/Jan/13 ]

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

Comment by Marco Pivetta [ 12/Jun/13 ]

Added failing test at https://github.com/doctrine/doctrine2/pull/693

Comment by Marco Pivetta [ 12/Jun/13 ]

Added test to prevent regressions at https://github.com/doctrine/doctrine2/commit/0a90279a99e58bac00258fbc17d6ab01fa466d70





[DDC-2209] [GH-540] [DDC-2208] Fix DDC-2208 Created: 20/Dec/12  Updated: 22/Dec/12  Resolved: 22/Dec/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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/540

Message:

This patch fix DDC-2208

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



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

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





[DDC-2208] CASE WHEN ... WHEN doesn't work Created: 19/Dec/12  Updated: 22/May/13  Resolved: 22/May/13

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

Type: Bug Priority: Major
Reporter: Miha Vrhovnik Assignee: Guilherme Blanco
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

Having the following part in select DQL throws an exception.

SUM(CASE
            WHEN c.startDate <= :start THEN c.endDate - :start
            WHEN c.endDate >= :end THEN :end - c.startDate
            ELSE 0
            END) 

exception:

[Syntax Error] line 0, col 124: Error: Expected Doctrine\ORM\Query\Lexer::T_ELSE, got '-' 

It seems that it's failing inside the second THEN

This one also seems to fail:

SUM(CASE
            WHEN c.startDate <= :start THEN (c.endDate - :start)
            WHEN c.endDate >= :end THEN (:end - c.startDate)
            ELSE 0
            END) 

exception:

[Syntax Error] line 0, col 60: Error: Unexpected '(' 

Another one:

SUM(CASE
                WHEN c.startDate <= :start THEN c.endDate - :start
                WHEN c.endDate >= :end THEN :end - c.startDate
                ELSE 0
                END) = :result FROM ...

exception:

[Syntax Error] line 0, col 60: Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got '=' 


 Comments   
Comment by Miha Vrhovnik [ 20/Dec/12 ]

I've added two more cases where the parsing fails. Do you want a separate tickets for that?

Comment by Fabio B. Silva [ 20/Dec/12 ]

Don't worry, I'll spend some time over this...
But I'm not sure about the last one.

Comment by Miha Vrhovnik [ 20/Dec/12 ]

The 3rd case seems work just fine as a part of a HAVING clause.
I haven't tried it but It might be that it fails with something simpler like SELECT COUNT( * ) = :foo FROM ... or SELECT COUNT( * ) = 2 FROM ...

Comment by Miha Vrhovnik [ 08/Jan/13 ]

Fabio I have two more...
It doesn't like NULL and subselect after then part

 
->addSelect('CASE
    WHEN po.quantity IS NULL THEN NULL
    ELSE po.quantity -
            COALESCE(0, (
                SELECT COUNT(rd.product) FROM xxxx rd
                    WHERE (rd.startDate <= :end) AND (rd.endDate >= :start) AND
                        rd.product = c.product)))
    END
    AS po.quantity
')

:edit replaced with real query

Comment by Miha Vrhovnik [ 08/Jan/13 ]

addon: well the subquery part can be full query with joins ....

Comment by Guilherme Blanco [ 22/May/13 ]

After further investigation, JPA 2.0 and 2.1 do not support NULL as part of ScalarExpression.
There are many underlying problems by adding this straight to ScalarExpression, such as the example I showed.
I don't think supporting this will bring benefits, but too many headaches.
As a workaround, create your own function that generates "NULL" as SQL. It would work perfectly here.
Closing the PR as we will not support it.

Comment by Miha Vrhovnik [ 22/May/13 ]

Not to sound rude but, the answer is far fetched. So what if JPA is not supporting it. Yes I understand that the Doctrine is modeled after JPA but this shouldn't mean that it's not better in some regards.

This is really a low blow especially if there is a need to use a query builder to build the queries. And as I said it's not only the IS NULL but the CASE statement can contain a whole subquery with it's own CASE statements etc...





[DDC-2205] Negative Values in Case Then expressions Created: 18/Dec/12  Updated: 21/Dec/12  Resolved: 21/Dec/12

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

Type: Bug Priority: Critical
Reporter: Ilya Biryukov Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: dql


 Description   

DQL Expression:

SELECT (CASE WHEN t.id = 1 THEN -1 ELSE t.id END) FROM Table t

Gives an error:
[Syntax Error] line 0, col 32: Error: Unexpected '-'

It doesn't seem to like the negative number.



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

Fixed : https://github.com/doctrine/doctrine2/commit/8b5e4a9a52670992b85e7223d255b98cf77a35a3





[DDC-2203] add EntityManager->getFilters()->isEnabled('filterName'') Created: 17/Dec/12  Updated: 01/Apr/13

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

Type: Improvement Priority: Minor
Reporter: Enea Bette Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Comments   
Comment by Paweł Nowak [ 10/Jan/13 ]

My pull request (https://github.com/doctrine/doctrine2/pull/548) contains an implementation of the method. Note that no exception is thrown if you query for the state of a non-existing filter - in such a case, false is returned as for disabled filters.





[DDC-2202] [GH-538] IDENTITY() Support composite primary key Created: 16/Dec/12  Updated: 24/Dec/12  Resolved: 24/Dec/12

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

Type: New Feature 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/538

Message:

This patch add support for composite primary key to identity function



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

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





[DDC-2201] [GH-537] fixed problems with joined inheritance and composite keys Created: 16/Dec/12  Updated: 04/May/13  Resolved: 04/May/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 Powerhamster:

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

Message:

SchemaTool now creates all Id columns not just only the first one.
Insert statement for child entity now contains parameter for additional key columns only once.



 Comments   
Comment by Doctrine Bot [ 04/May/13 ]

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





[DDC-2188] DQL arithmetic priority is not considered in expression 'a/(b*c)' Created: 05/Dec/12  Updated: 06/Apr/13  Resolved: 06/Apr/13

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

Type: Bug Priority: Major
Reporter: Mahdi Dehghani Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: Cli, mysql


 Description   

A DQL query that contains an arithmetic expression like 'a/(b*c)' will be compiled to 'a/b*c' in SQL and therefore the result of '100/(2*2)' will be 100, instead of 25.

Note: I have tested it by mysql only



 Comments   
Comment by Marco Pivetta [ 16/Mar/13 ]

Being handled in DDC-2355





[DDC-2187] [GH-531] use base events Created: 05/Dec/12  Updated: 24/Dec/12  Resolved: 24/Dec/12

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

Type: Improvement 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 docteurklein:

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

Message:

in consequence of https://github.com/doctrine/common/pull/222






[DDC-2186] PreFlushEventArgs not passed by ClassMetadataInfo::invokeLifecycleCallbacks() Created: 05/Dec/12  Updated: 02/Feb/13  Resolved: 02/Feb/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: 2.3
Fix Version/s: 2.4

Type: Improvement Priority: Major
Reporter: Kevin Herrera Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   

As described in the documentation (http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#preflush) my pre-flush lifecycle callback is not receiving an instance of Doctrine\ORM\Event\PreFlushEventArgs when called in Doctrine\ORM\Mapping\ClassMetadataInfo::invokeLifecycleCallbacks().



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

Hi Kevin,
The current lifecycle event system does not allow access to the event args. :
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#lifecycle-callbacks.

Now it is possible just by using the EventManager :
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#listening-to-lifecycle-events

Just after DDC-1955 : (https://github.com/doctrine/doctrine2/pull/423) be merged it will be possible.

Cheers

Comment by Fabio B. Silva [ 13/Dec/12 ]

Change issue type, since it's not a bug.

Comment by Fabio B. Silva [ 02/Feb/13 ]

fixed : https://github.com/doctrine/doctrine2/commit/71a68a5c6fcd49538c3ef2f86d64bcde1958251c





[DDC-2181] [GH-528] Documentation fixes Created: 01/Dec/12  Updated: 23/Dec/12  Resolved: 23/Dec/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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/528

Message:

This is a first batch of documentation fixes:

  • Missing docblocks
  • Missing / incorrect `@param` / `@return` / `@throws` annotations
  • Missing newlines between annotations
  • Incorrect vertical alignment of `@param` annotations

I'm willing to make more documentation fixes on this project, but I'll wait for your feedback on this first batch before moving forward!

Let me know if you have any comment / suggestion / question.






[DDC-2174] [GH-526] [DDC-2172] Fix EntityGenerator get literal type Created: 27/Nov/12  Updated: 27/Nov/12  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





[DDC-2173] [GH-525] Ensure onFlush and postFlush events are always called Edit Created: 27/Nov/12  Updated: 06/Jan/13  Resolved: 06/Jan/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 frosas:

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

Message:

See #398 (has been closed as it wasn't against the master branch)






[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-2169] [GH-524] EntityManagerDecorator base class as an extension point for EntityManager Created: 26/Nov/12  Updated: 04/May/13  Resolved: 04/May/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 lstrojny:

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

Message:

As discussed on IRC. Open issues to be discussed:



 Comments   
Comment by Doctrine Bot [ 04/May/13 ]

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





[DDC-2153] [GH-517] Fix for DDC-1765 Created: 17/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.4
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 nemekzg:

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

Message:



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

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





[DDC-2151] [GH-515] Fixes sandbox cli: The helper "em" is not defined. Created: 16/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.4
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 tranver:

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

Message:

In afd8ea9 $helpers became an instance of HelperSet and caused an "The helper "em" is not defined." exception.



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

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





[DDC-2142] [GH-513] Enumeration support Created: 13/Nov/12  Updated: 21/Nov/12  Resolved: 21/Nov/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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/513

Message:

This patch adds support for ``@Enum``. https://github.com/doctrine/common/pull/167

Please let me know if there is another annotations where we can use ``@Enum``.



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

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

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

Merged : https://github.com/doctrine/common/commit/30b8cea3bfe22f5eb58b5b0165f21df750aeb2e2





[DDC-2138] Foreign Keys in STI are wrong when same field is reused in different classes. Created: 12/Nov/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.4
Security Level: All

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


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

See https://github.com/doctrine/doctrine2/pull/440





[DDC-2137] [GH-510] CS on QueryBuilder Created: 12/Nov/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.4
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 ruian:

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

Message:



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

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





[DDC-2136] convert-mapping can't create YML from Annotation when Id column is a OneToOne relationship Created: 11/Nov/12  Updated: 01/May/13  Resolved: 01/May/13

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

Type: Bug Priority: Minor
Reporter: Gergely Polonkai Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: yaml
Environment:

Symfony 2.1.3



 Description   

I have two entities

/**

  • @ORM\Entity
    */
    class User { /** * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") * @ORM\Column(type="integer") */ private $id }

/**

  • @ORM\Entity
    */
    class UserData { /** * @ORM\Id * @ORM\OneToOne(targetEntity="User") */ private $id }

When I convert these with symfony's

doctrine:mapping:convert yml test/

it generates an entity definition for UserData without any id fields, which, of course, cannot be imported to the database, as the new entity doesn't have an identifier column.



 Comments   
Comment by Benjamin Eberlei [ 01/May/13 ]

Fixed in 2.4





[DDC-2132] [GH-509] SchemaTool ignoring 'fixed' option Created: 07/Nov/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.4
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 smottt:

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

Message:

If the column is set to fixed string length like this:

```php
<?php

/**

  • @ORM\Column(type="string", length=2, options= {"fixed" = true}

    )
    */
    protected $foo;
    ```

The schema tool will not detect that 'fixed' option correctly when generating update SQL.

Fix attached.



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

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





[DDC-2106] Notice trying to match a Criteria referencing a managed entity not yet persisted Created: 29/Oct/12  Updated: 01/May/13  Resolved: 01/May/13

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

Type: Bug Priority: Minor
Reporter: Francesc Rosàs Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   
Undefined index: (...) in Doctrine/ORM/UnitOfWork.php line 2735

#0 doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(2735): Symfony\Component\HttpKernel\Debug\ErrorHandler->handle(8, 'Undefined index...', '/Users/frosas/S...', 2735, Array) 
#1 doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php(1696): Doctrine\ORM\UnitOfWork->getEntityIdentifier(Object(MyEntity)) 
#2 doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php(1683): Doctrine\ORM\Persisters\BasicEntityPersister->getIndividualValue(Object(MyEntity)) 
#3 doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php(818): Doctrine\ORM\Persisters\BasicEntityPersister->getValue(Object(MyEntity)) 
#4 doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php(786): Doctrine\ORM\Persisters\BasicEntityPersister->expandCriteriaParameters(Object(Doctrine\Common\Collections\Criteria)) 
#5 doctrine/orm/lib/Doctrine/ORM/PersistentCollection.php(835): Doctrine\ORM\Persisters\BasicEntityPersister->loadCriteria(Object(Doctrine\Common\Collections\Criteria)) 
#6 (...): Doctrine\ORM\PersistentCollection->matching(Object(Doctrine\Common\Collections\Criteria)) 
#7 (...)

As a workaround I had to control this case explicitly:

if ($myEntity->getId() === null) return null;
$criteria = Criteria::create()->where(Criteria::expr()->eq('field', $myEntity));
return $this->collection->matching($criteria)->first();


 Comments   
Comment by Alexander [ 09/Feb/13 ]

Can you provide us with the mapping of your entities? The code shouldn't get to the point where it asks for the identifier of the object while the object isn't persisted yet.

Comment by Francesc Rosàs [ 10/Feb/13 ]

I'm not sure mapping can help to solve this and is quite a work for me to get it without the client details. Anyway I'll try to reproduce it in a custom scenario if you require it.

I've been doing some debugging and I got this:

  • It still fails with last 2.3.*@stable
  • Entity is persisted before matching(). At UnitOfWork::persistNew(), $this->entityStates[$oid] is set to self::STATE_MANAGED but $this->entityIdentifiers is untouched ($idGen->isPostInsertGenerator() is true)
  • When BasicEntityProvider::getIndividualValue() is called, $value state is STATE_MANAGED but $uow->getEntityIdentifier() fails because $uow->entityIdentifiers[$oid] was never set.

Hope it helps.

Comment by Alexander [ 10/Feb/13 ]

If you can create a testcase and send a PR with it that would be very helpful. You can create it and put in in the appropriate class here:
https://github.com/doctrine/doctrine2/tree/master/tests/Doctrine/Tests/ORM/Functional/Ticket

Comment by Francesc Rosàs [ 16/Feb/13 ]

Here you have: https://github.com/doctrine/doctrine2/pull/582

Comment by Benjamin Eberlei [ 01/May/13 ]

Fixed in 2.4





[DDC-2091] [GH-486] Fix DDC-2084 Created: 20/Oct/12  Updated: 21/Nov/12  Resolved: 21/Nov/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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/486

Message:

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



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

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





[DDC-2090] MultiTableUpdateExecutor works incorrect with query cache enabled Created: 19/Oct/12  Updated: 17/Mar/13  Resolved: 17/Mar/13

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

Type: Bug Priority: Major
Reporter: Valera Leontyev Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   

Doctrine\ORM\Query\Exec\MultiTableUpdateExecutor works incorrect with query cache enabled.
I execute two similar update-queries with different parameters, but the second query is never executed in database.

There is todo-task in code:

//FIXME (URGENT): With query cache the parameter is out of date. Move to execute() stage.

This is important issue. Much time spent in debugging.



 Comments   
Comment by Valera Leontyev [ 19/Oct/12 ]

Workaround is to disable query cache per every multitable update query: http://stackoverflow.com/questions/12969460/doctrine-query-cache-update

Comment by Fabio B. Silva [ 17/Mar/13 ]

Fixed : https://github.com/doctrine/doctrine2/commit/60b8bc63a1a4819cf112cfbbc7cca06b5792aba6

Comment by Benjamin Eberlei [ 17/Mar/13 ]

Merged into 2.3 for release with 2.3.3





[DDC-2089] Modify OneToMany to allow unidirectional associations without the need of a JoinTable Created: 19/Oct/12  Updated: 16/Dec/12

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.x
Fix Version/s: 2.4, 3.0
Security Level: All

Type: Improvement Priority: Major
Reporter: Enea Bette Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: onetomany, persister, unidirectional
Environment:

Debian Wheezy, Mysql 5.1, Apache2, PHP 5.4



 Description   

As I sayd in the title, it would be nice if the ORM layer could permit to map a 1:n association in the db as an unidirectional OneToMany in the classes, without using a JoinTable in the database.
This would permit us to get rid of the unnecessary database JoinTable, which creates disorder and decreases performance for no valuable reason.

Is it possible?



 Comments   
Comment by Enea Bette [ 16/Dec/12 ]

A little up... for inspiration from JPA

http://en.wikibooks.org/wiki/Java_Persistence/OneToMany#Undirectional_OneToMany.2C_No_Inverse_ManyToOne.2C_No_Join_Table_.28JPA_2.0_ONLY.29





[DDC-2083] [GH-482] user can set its own commands in the cli-config.php file Created: 16/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.4
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 Halleck45:

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

Message:

Today we need to edit source to add custom commands. With this minor change, we can add custom commands directly in the cli-config.php file :

````
require_once "app/bootstrap.php";
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($entityManager)
));

// example here
$commands = array(
new Doctrine\ORM\Tools\Console\Command\LoadDataCommand
);
````






[DDC-2062] [GH-466] Use `protected` so EntityGenerator can be extended Created: 09/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.4
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 ethanresnick:

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

Message:

This is definitely something I'd like to be able to extend, and I imagine others might too.






[DDC-2056] [GH-462] [DDC-2055] Generate SELECT clause from ResultSetMappingBuilder Created: 03/Oct/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.4
Security Level: All

Type: New Feature 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 beberlei:

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

Message:

Add support to generate entity result parts of the SELECT clause from a ResultSetMappingBuilder instance. Add support for column incrementing.

Sample:

public function testGenerateSelectClauseIncrement()

{ $rsm = new ResultSetMappingBuilder($this->_em); $rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsUser', 'u', ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT); $selectClause = $rsm->generateSelectClause(); $this->assertEquals('u.id AS id0, u.status AS status1, u.username AS username2, u.name AS name3, u.email_id AS email_id4', $selectClause); }

Restrictions:

This only generates the entity result clauses, not the ones for scalar results! Because we don't know what the scalar result actually means.



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

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





[DDC-2055] Helper to generate SQL SELECT clause for Native Query Created: 03/Oct/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.4
Security Level: All

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





[DDC-2054] [GH-461] [SchemaValidator] Fix typo Created: 03/Oct/12  Updated: 03/Oct/12  Resolved: 03/Oct/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 franmomu:

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

Message:



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

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





[DDC-2052] Custom tree walkers are not allowed to add new components to the query Created: 02/Oct/12  Updated: 14/May/13

Status: Reopened
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: 2.3
Fix Version/s: 2.4

Type: Improvement Priority: Major
Reporter: Łukasz Cybula Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: dql


 Description   

Custom tree walkers have freedom in modifying the AST but when you try to add a new query component (i.e. new join in walkSelectStatement() ) to the AST then the SqlWalker throws an exception because it does not has the new component in its _queryComponents array. I see two possible ways to resolve this:
1. Modify the Parser class in order to allow tree walkers to modify queryComponents and pass changed queryComponents to the SqlWalker
2. Improve SqlWalker so it can extract and prepare needed information about queryComponent based on AST when it does not have them.



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

Ok this is much more complicated to allow then i thought. The problem is that the QueryComponents are passed by value, as an array, not by reference. That prevents changing them because this change wouldn't be visible in the output walker.

I can add a method to allow this in the OutputWalker for now, but generally this requires a bigger refactoring on the Query Components.

Comment by Benjamin Eberlei [ 06/Oct/12 ]

Added setQueryComponent() in SQL Walker to allow modification in output walker.

Comment by Łukasz Cybula [ 08/Oct/12 ]

I'm afraid that this doesn't solve the initial problem at all. I'll try to describe it in more details to show what I mean. Suppose we have two doctrine extensions each of which contain its own tree walker. Each of these tree walkers need to modify AST and add new component to it (joined with some component already existing in the query). The first problem is that each tree walker has its own queryComponents array which is not passed between them, although they not necessary need to use queryComponents - they could use only AST. The second, bigger problem is that the Parser class does not know anything about modifications of queryComponents in tree walkers and cannot pass modified version to the OutputWalker. The goal of submitting this issue was to allow adding new components to the query in tree walkers which is not achievable by your fix. I think it may be the first step in the right direction. Maybe TreeWalkerAdapter should have public method getQueryComponents() which would be used by the Parser to pass modified queryComponents between different tree walkers and finally to the OutputWalker ? This would not break backward compatibility and solve this issue. What do you think about it?

Comment by Łukasz Cybula [ 08/Oct/12 ]

I've tried to implement the solution mentioned in previous comment but it's also not so clean and easy as I thought. Each tree walker (including TreeWalkerChain) would have to implement getQueryComponents() and setQueryComponent($alias, array $component) methods. The same with SqlWalker, so the TreeWalker interface should have these methods, which would break BC in some way (walkers that do not inherit from SqlWalker or TreeWalkerAdapter will fail to compile). So maybe my first solution (PR #464) is not so bad for now? In the future queryComponents could be replaced by a special object or could be passed by a reference to allow modifications.

Comment by Benjamin Eberlei [ 09/May/13 ]

Marked as improvement as its not a bug.

A solution might probably implement an object holding all the QueryComponent, implementing ArrayAccess. So that way the state can be shared.

Comment by Marco Pivetta [ 14/May/13 ]

Just hit this while developing an ast walker... Will look into it too since I need it more than soon.

Comment by Marco Pivetta [ 14/May/13 ]

As a VERY UGLY workaround, I used a static variable and a custom sql walker in combination with my AST walker.


namespace Comcom\Versioning\ORM\Query;


use Doctrine\ORM\Query\SqlWalker;

class WorkaroundSqlWalker extends SqlWalker
{
    public function __construct($query, $parserResult, array $queryComponents)
    {
        parent::__construct($query, $parserResult, $queryComponents);

        foreach (VersionWalker::$additionalAliases as $alias => $value) {
            $this->setQueryComponent($alias, $value);
        }
    }
}




[DDC-2051] after filtering an association by using ->matching(Criteria) original association changes Created: 02/Oct/12  Updated: 15/Oct/12  Resolved: 15/Oct/12

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

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


 Description   

after filtering an association with a criteria it changes so it's not a normal collection and you can't re-filter it.

even after hydrating it you can't filter it.



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

The filtering only works once and only if the database hasn't been queried!

This is a major bug because i would like to filter big collections more than once per request.

Comment by Benjamin Eberlei [ 06/Oct/12 ]

Can you add a code example? I don't understand what you mean.

Comment by Koby Soto [ 07/Oct/12 ]

sure: here's just an example (written right now to demonstrate, not taken from real project, so no criticize pls):

Let's say we have two functions:

1. function getExpensiveBooks($limit)

{ $books = $this->getBooks(); //proxy, haven't queried yet. $criteria = Criteria::create()->where(Criteria::expr()->gt('price', '10'))->setMaxResults($limit); return $books->matching($criteria); }

2. function getCheapBooks($limit)

{ $books = $this->getBooks(); //proxy, haven't queried yet. $criteria = Criteria::create()->where(Criteria::expr()->lt('price', '4'))->setMaxResults($limit); return $books->matching($criteria); }

now, let's say that in the controller i've called:
$expensiveBooks = $author->getExpensiveBooks(3); //will work fine, and the query will be according the criteria.
//but going on and doing this:
$cheapBooks = $author->getCheapBooks(3); //will not work: matching is undefined function.

It appears that doing matching only works on the first time on a certain association.

Comment by Koby Soto [ 15/Oct/12 ]

this was due to inconsistent association type in both owner and target (target had one-to-one while owner had one-to-many)

sorry





[DDC-2049] [GH-458] Use cascade=all if all cascade options set Created: 29/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.4
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 barelon:

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

Message:

The YAML and XML metadata exporters output cascade=all if all five cascade options are set. The php and annotation exporter do not, they output cascade=list of all 5 cascades instead.

In order that all 4 exporters offer the same behavior, I updated the php and annotations exporters so that they export cascade=all



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

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





[DDC-2047] [GH-456] Optimize autoload prefix in composer.json Created: 28/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.4
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 Slamdunk:

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

Message:

By having more specific autoload prefixes it is possible to reduce the number of stat calls made.



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

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





[DDC-2044] [GH-455] Fixed unique-constraint name in XML Exporter Created: 26/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.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





[DDC-2020] [GH-440] The schema tool now doesn't add a foreign constraint when subclassess of... Created: 08/Sep/12  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 sroddy:

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

Message:

... a STI use the same field to map relations with entities of different classes

It seems that there are no particular side-effects in mapping different relationship using the same table column name in different subclasses of a STI hierarchy.
Eg. Tag superclass of BookTag (id, object_id, comment) and MovieTag (id, object_id, comment), so having two attributes $book and $movie mapped to the same object_id field with @JoinColumn annotation

I wasn't sure about this so I tested to see if there were errors. And I was surprised that everything runs without any particular problem.
Moreover this is a really interesting (wanted? unwanted?) feature, very useful if you have huge tables that need to be joined with other table using the discriminator and object_id columns, or if you have some kind of logging class and you need to keep the table efficient and small. The only problem is that the schema generator always inserts a foreign column constraint (probably the last specified) when generating these kind of Entities.

This PR ensures that the foreign key is not added if there are at least two different classes mapped on the same field of a db table.






[DDC-2019] addOrderBy function incomplete Created: 07/Sep/12  Updated: 09/Feb/13  Resolved: 09/Feb/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.2.3
Fix Version/s: 2.4

Type: Bug Priority: Minor
Reporter: Jérôme Forêt Assignee: Alexander
Resolution: Fixed Votes: 0
Labels: None


 Description   

In QueryBuilder.php, just change or complete addOrderBy function

public function addOrderBy($sort, $order = null)

Unknown macro: { $orderBy = ($sort instanceof ExprOrderBy) ? $sort }


 Comments   
Comment by Alexander [ 09/Feb/13 ]

Fixed in https://github.com/doctrine/doctrine2/commit/1a163cd48dc8b691351f0a9fee3e2286fe0af984





[DDC-2016] DQL Parser fails in select clause Created: 07/Sep/12  Updated: 23/Nov/12  Resolved: 23/Nov/12

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

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


 Description   

Executing the following query inside the sandbox:

$r = $em->createQuery('SELECT u, (((3))) as v FROM Entities\User u')->getResult();

results in the following exception:

PHP Fatal error:  Uncaught exception 'Doctrine\ORM\Query\QueryException' with message '[Syntax Error] line 0, col 10: Error: Expected known function, got '('' in /mnt/D/Jobs/Wanderwalter/htdocs/doctrineTest/doctrine2/lib/Doctrine/ORM/Query/QueryException.php:42
Stack trace:
#0 /mnt/D/Jobs/Wanderwalter/htdocs/doctrineTest/doctrine2/lib/Doctrine/ORM/Query/Parser.php(380): Doctrine\ORM\Query\QueryException::syntaxError('line 0, col 10:...')
#1 /mnt/D/Jobs/Wanderwalter/htdocs/doctrineTest/doctrine2/lib/Doctrine/ORM/Query/Parser.php(3001): Doctrine\ORM\Query\Parser->syntaxError('known function', Array)
#2 /mnt/D/Jobs/Wanderwalter/htdocs/doctrineTest/doctrine2/lib/Doctrine/ORM/Query/Parser.php(2975): Doctrine\ORM\Query\Parser->CustomFunctionDeclaration()
#3 /mnt/D/Jobs/Wanderwalter/htdocs/doctrineTest/doctrine2/lib/Doctrine/ORM/Query/Parser.php(1907): Doctrine\ORM\Query\Parser->FunctionDeclaration()
#4 /mnt/D/Jobs/Wanderwalter/htdocs/doctrineTest/doctrine2/lib/Doctrine/ORM/Query/Parser.php(1048): Doctrine\ORM\Query\Parser->SelectExp in /mnt/D/Jobs/Wanderwalter/htdocs/doctrineTest/doctrine2/lib/Doctrine/ORM/Query/QueryException.php on line 42


 Comments   
Comment by Stefan Klug [ 07/Sep/12 ]

Solution is available at https://github.com/doctrine/doctrine2/pull/438

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

Fixed : https://github.com/doctrine/doctrine2/commit/ec1950d3cac918935e0f05c1fb79bbd592caed87





[DDC-2000] [GH-431] [ORM] Fix double semicolon Created: 29/Aug/12  Updated: 29/Aug/12  Resolved: 29/Aug/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
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 pitiflautico:

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

Message:



 Comments   
Comment by Benjamin Eberlei [ 29/Aug/12 ]

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





[DDC-1998] Problem when deleting with EntityManager->remove($entity) Created: 28/Aug/12  Updated: 01/May/13  Resolved: 01/May/13

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

Type: Bug Priority: Minor
Reporter: victor Velkov Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None

Attachments: File DDC1998Test.php     File DDC1998Test1.php     File EwtTimestamp.php     File ProductTemplate.php    

 Description   

The problem is when using EntityMamager->remove($entity). The Sql query generated doesn't convert the values of the ids according to the field type that is used in doc block annotation. After investigating I found that in Doctrine\DBAL\Connection the function delete doesn't support to receive as param the types of the ids to be given to the executeUpdate function which is called in it and supports them. (The types need to be provided from the persisters from which the delete is called).

I hope it make sense to you. I got that problem because I am using custom time stamp column type as id. And it converts the value of the field to time stamp string, which if not converted to the proper sql value is not recognised and the delete doesn't go trough.

As far as I can see it is something that was missed and hope it will be fixed soon.

If you have any questions please ask.
Also on request I can provide example code and the fix I have done for myself.



 Comments   
Comment by Fabio B. Silva [ 29/Aug/12 ]

Hi Victor

Could you attach/paste your custom type and entity please ?

Comment by victor Velkov [ 30/Aug/12 ]

Ok I have attached them. The EwtTimestamp is the custom type.

Comment by Marco Pivetta [ 17/Sep/12 ]

victor Velkov do you have a failing test case for this one?

Comment by victor Velkov [ 17/Sep/12 ]

Nope sorry haven't done any test cases for this one

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

Hi Victor,

I can't reproduce, could you change the added test case and try to make it fails ?

Thanks

Comment by victor Velkov [ 26/Sep/12 ]

Sure will do it as soon as I can. Sorry I didn't answer sooner just was in a holiday

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

Thanks Victor

Please let me know when you change the test

Comment by victor Velkov [ 02/Oct/12 ]

Sorry for the delay i have attached the test case (DDC1998Test1.php).

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

Hi Victor,

Sorry for the delay to answer

I think that we can't fix it,
Your type requires sql conversion to work, and doctrine does not support @Id fields with sql conversion.

Comment by victor Velkov [ 11/Oct/12 ]

Really as far as i can see in the code you do convert them when you are executing an update. And the fix that i did for my self is to add 3rd parameter to the function delete in Doctrine\DBAL\Connection and then every where where it is called in the code which is in 2 places Doctrine\ORM\Persisters\BasicEntityPersister and Doctrine\ORM\JoinedSubclassPersister to give that parameter with the types. And as far as i can see you do that for the updates. After that in Connection delete you call the executeUpdate which supports the type and you just have to pass it along. And that is it.

Comment by Marco Pivetta [ 23/Jan/13 ]

Reducing priority. It is an edge case, and we already don't officially support custom object types as identifiers.

Comment by Benjamin Eberlei [ 01/May/13 ]

We should be able to support this I think, i don't see a reason it shouldnt work

Comment by Benjamin Eberlei [ 01/May/13 ]

Will be fixed in 2.4





[DDC-1995] "Query Exception: Invalid parameter number: number of bound variables does not match number of tokens" when using an "Instance Of" expression Created: 22/Aug/12  Updated: 07/Jun/13  Resolved: 07/Jun/13

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

Type: Bug Priority: Major
Reporter: Craig Marvelley Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   

Similar to this issue I think, but triggered when performing a query on entities modelled with Class Table Inheritance, e.g.

$qb = $repository->createQueryBuilder('entity');
$metadata = $em->getClassMetadata($class);
$qb->where('entity INSTANCE OF :type')->setParameter('type', $metadata);
$qb->getQuery()->execute();

Seems that there isn't a corresponding entry in the parameter mapping array for this clause, which triggers the exception at line 254 of Doctrine\ORM\Query:

if (count($paramMappings) != count($this->parameters))

{ throw QueryException::invalidParameterNumber(); }

 Comments   
Comment by Craig Marvelley [ 22/Aug/12 ]

Pull request with a potential fix: https://github.com/doctrine/doctrine2/pull/429

Comment by Benjamin Eberlei [ 29/Aug/12 ]

Assigned to Guilherme

Comment by Fabio B. Silva [ 07/Jun/13 ]

Fixed : https://github.com/doctrine/doctrine2/commit/462173ad71ae63cd9877e1e642f7968ed1f9971b





[DDC-1981] ProxyFactory does not throw exceptions that are verbose enough (hard to debug) Created: 13/Aug/12  Updated: 26/Jan/13  Resolved: 23/Jan/13

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

Type: Improvement Priority: Minor
Reporter: Marco Pivetta Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: None


 Description   

Basically need to display the path of the given proxy in the error message, that makes debugging much easier



 Comments   
Comment by Marco Pivetta [ 23/Jan/13 ]

Handled in DCOM-96

Comment by Benjamin Eberlei [ 25/Jan/13 ]

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

Comment by Benjamin Eberlei [ 26/Jan/13 ]

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





[DDC-1980] [GH-423] DDC-1955 - @EntityListeners Created: 12/Aug/12  Updated: 27/Feb/13  Resolved: 27/Feb/13

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

Type: New Feature 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/423

Message:

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

Hi.

This path adds support for ```@EntityListeners```

This path add another way to handle events
allow configure the same listener for many specific entities.
And give the EventArg in the current lifecycle callback system.

Usage :

```php
<?php
/**

  • @EntityListeners( {"ContractListener"}

    )

  • @HasLifecycleCallbacks
  • @Entity
    */
    class Contract
    {
    /** @PostLoad */
    public function postLoadHandler(LifecycleEventArgs $event) { // do something }
    }
    class ContractListener
    {
    /** @PrePersist */
    public function prePersistHandler(Contract $contract)
    { // do something }

    /**

  • @PostPersist
  • Most of cases just the entity is needed.
  • as a second parameter LifecycleEventArgs allow access to the entity manager.
    */
    public function postPersistHandler(Contract $contract, LifecycleEventArgs $args) { // do something }

    }
    ```



 Comments   
Comment by Fabio B. Silva [ 27/Feb/13 ]

Merged : https://github.com/doctrine/doctrine2/commit/71a68a5c6fcd49538c3ef2f86d64bcde1958251c





[DDC-1979] [GH-422] DDC-1574 - "new" operator Created: 12/Aug/12  Updated: 27/Feb/13  Resolved: 27/Feb/13

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

Type: New Feature 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/422

Message:

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

Hi guys.

This path adds support for "new" operator

Usage :
```SQL
SELECT
new CustomerDTO(c.name, e.email, a.city)
FROM
Customer c
JOIN
u.email e
JOIN
u.address a
ORDER BY
u.name
```

Any simple class with a constructor could be used
but for the first version just scalar values are allowed.

it's a big patch, so any sugestion are welcome.

Thanks.



 Comments   
Comment by Fabio B. Silva [ 27/Feb/13 ]

Merged : https://github.com/doctrine/doctrine2/commit/13762f20c9f6daa0c2e4e8a113de01969c6621da





[DDC-1956] [GH-413] code refactorings on persister Created: 29/Jul/12  Updated: 14/Mar/13  Resolved: 14/Mar/13

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

Type: Improvement 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/413

Message:

hi

This patch does not add any feature, just small refactorings and code clean up.
It make easier to implement the generation of persisters:
http://www.doctrine-project.org/jira/browse/DDC-1889

Cheers ...



 Comments   
Comment by Fabio B. Silva [ 14/Mar/13 ]

Merged : https://github.com/doctrine/doctrine2/commit/05e5ae8bfa1a452d273a3a6b27b6311c287a9976





[DDC-1955] Support for @EntityListeners Created: 29/Jul/12  Updated: 02/Feb/13  Resolved: 02/Feb/13

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

Type: New Feature Priority: Minor
Reporter: Fabio B. Silva Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   

Support for @EntityListeners

Now subscribers are called for ALL entities, to increase the performance we should allow the configuration listeners for entities that need them.

The @EntityListeners annotation specifies the callback listener classes to be used for an entity or mapped superclass. The @EntityListeners annotation may be applied to an entity class or mapped superclass.

The listenner callbacks methods are annotated by the current callback annotations (@PreUpdate, @PrePersist, etc...)

Example :

/**
 * @EntityListeners({"ContractSubscriber"})
 */
class CompanyContract
{
}

class ContractSubscriber
{
    /**
     * @PrePersist
     */
    public function prePersistHandler(CompanyContract $contract)
    {
        // do something
    }

    /**
     * @PostPersist
     * Most of cases just the entity is needed.
     * as a second parameter LifecycleEventArgs allow access to the entity manager.
     */
    public function postPersistHandler(CompanyContract $contract, LifecycleEventArgs $args)
    {
        // do something
    }
}

$contract = new CompanyFlexContract();
// do something

$em->persist($contract);


 Comments   
Comment by Christophe Coevoet [ 30/Jul/12 ]

I don't see how this could improve performances much: there is only one event manager, so all listeners would be registered in the same. This means that the event manager would then need to contain some checks to know whether the listener should be called for this entity. This means that it will add overhead for all listeners instead of only in listeners needing to check the entity.

Comment by Marco Pivetta [ 30/Jul/12 ]

Christophe Coevoet I think there's a bit of overhead when calling the event listeners. Btw we could get a huge improvement if the UoW was able to group the operations by entity name. I'm not sure if this already happens.

Comment by Fabio B. Silva [ 30/Jul/12 ]

Hi guys

This feature does not change anything on the current event system, just add another way to handle events.
Actually, the event manager dont filter/group event calls.
So, the listener implementation must filter which entities accept and process.

My idea is build something more simple, like lifecycle callbacks instead of use a event manager.
Grouping the calls in the entity metadata and centralizing the listener instances in a static point.

It should avoid lots of calls from UoW to notify entities without subscribers.

Comment by Fabio B. Silva [ 02/Feb/13 ]

fixed : https://github.com/doctrine/doctrine2/commit/71a68a5c6fcd49538c3ef2f86d64bcde1958251c





[DDC-1872] Evaluate @AssocationOverride/@AttributeOverride in context of Traits Created: 12/Jun/12  Updated: 06/Oct/12  Resolved: 06/Oct/12

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

Type: Documentation Priority: Major
Reporter: Benjamin Eberlei Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: documentation


 Description   

If there is a property $foo in a trait, then the using entity should maybe modify that $foo using @AttributeOverride and @AssociationOverride?



 Comments   
Comment by Luis Cordova [ 29/Jul/12 ]

done https://github.com/doctrine/orm-documentation/pull/117

Comment by Benjamin Eberlei [ 06/Oct/12 ]

Added test





[DDC-1852] Doctrine\ORM\Tools\SchemaValidator should check validity of lifecycle callbacks Created: 04/Jun/12  Updated: 20/Sep/12

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

Type: Improvement Priority: Major
Reporter: Marco Pivetta Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

The schema validator should analyze mapped lifecycle callbacks and:

a) if some lifecycle callbacks were defined, but no @HasLifecycleCallbacks annotation/mapping was set, warn the user
b) if some lifecycle callbacks were defined, but methods are not public, warn the user



 Comments   
Comment by Marco Pivetta [ 04/Jun/12 ]

Existing PR at https://github.com/doctrine/doctrine2/pull/361





[DDC-1840] Create ParameterCollection indexed and implement it on AbstractQuery and QueryBuilder Created: 26/May/12  Updated: 20/Sep/12

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

Type: Improvement Priority: Major
Reporter: Guilherme Blanco Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Currently, method setParameters in AbstractQuery and QueryBuilder only appends new parameters to the list. It should actually override the existing ones.
To be able to correctly fix this, we need to create a ParameterCollection which we can use/reuse to set/remove/append new parameters.
These elements should also support parameter types.



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

Not a bug





[DDC-1738] Allow multiple Generators per class Created: 29/Mar/12  Updated: 20/Sep/12

Status: Open
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: Git Master
Fix Version/s: 2.4
Security Level: All

Type: Improvement Priority: Major
Reporter: Guilherme Blanco Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

We should be able to support multiple generators per class.
When doing partition per table, the partitioned column must be part of PK, which may enter in our limitation.

Currently we only support 1 generator per class.






[DDC-1723] Custom ID Generators Created: 22/Mar/12  Updated: 20/Sep/12

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

Type: New Feature Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Allow specify custom id generators, pull request is GH-206

https://github.com/doctrine/doctrine2/pull/206






[DDC-1624] Locking CTI doesnt work on SQL Server Created: 29/Jan/12  Updated: 20/Sep/12

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.2
Fix Version/s: 2.4
Security Level: All

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


 Description   

The WITH Keyowrd is appended to the whole FROM .. JOIN .. block instead of behind the FROM block.






[DDC-1621] Add support for FROM Class1 a1 JOIN Class2 a2 WITH cond queries Created: 25/Jan/12  Updated: 30/Dec/12

Status: In Progress
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: New Feature Priority: Major
Reporter: Benjamin Eberlei Assignee: Alexander
Resolution: Unresolved Votes: 1
Labels: None


 Description   

Check feasibility of this kind of query different from FROM Class1 a1, Class2 a2 to allow arbitrary joins between classes.



 Comments   
Comment by Alex [ 30/Nov/12 ]

Hi all!
Maybe if this task is hard, you could do a simplier variant, "FROM Class1 a1 JOIN a1,a2 WITH a2 INSTANCE OF Class2"?
Doctrine 2.3 supports it, but in fact, it does not work. I can't use Class2 fields in query, and Doctrine ignores the INSTANCE OF operator when building a native queries.
I am working with system where I have many inherited classes with Class Table Inheritance. When I do a JOIN query, it generates native sql query more than 1KB(?!) length, and MySQL freezes for more than 7 minutes (?!) on it. It must join only tables for Class2, but it joins all my 20 tables inherited of my base class
I don't know where to send bugreport
It will be very good if I could manually select a joined class to make Doctrine do a better queries.
Sorry for my english, I am from Moscow.





[DDC-1599] OnFlush event in transaction Created: 14/Jan/12  Updated: 20/Sep/12

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: Git Master
Fix Version/s: 2.4

Type: Improvement Priority: Major
Reporter: Gediminas Morkevicius Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 2
Labels: None


 Description   

Is there any particular reason why onFlush event is not triggered when the transaction is allready open? https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L290 It would help a lot developing listeners since this event is the mostly used one and since theres preFlush now it seems a logical solution if onFlush would be a start of transaction in general



 Comments   
Comment by Benjamin Eberlei [ 14/Jan/12 ]

onFluish is not the start of a transaction. It has nothing to do with this.

Comment by Marco Pivetta [ 31/Mar/12 ]

Is a third event needed? Or is this to be marked as "won't fix"?

Comment by Benjamin Eberlei [ 31/Mar/12 ]

Maybe onBeginTransaction, onCommit and onRollback.

However since you can start transactions manually using $em->beginTransaction(), the Flush events are somehwat independent of transactions anyways.

Comment by Gediminas Morkevicius [ 31/Mar/12 ]

Well, user can start transaction anytime, but the fact is that if we think ORM we do not know nothing about the database. we just persist and flush objects.

Yes I think these would be very useful, from how I see it, if you use event listeners, is:

loadClassMetadata: you can apply extra mapping

onFlush: you can modify entity changesets, or persist recalculate new ones, without triggering the database, since it is not used to begin the database modifications yet.

onBeginTransaction: could use the database modifications keeping in sync the entity changesets. the thing about this event is that usually in behavioral way atomic updates are required. for example nestedset tree sync lft rgt columns, sortable sync the sort index, materialized path, all these requires atomic updates, and the best place is the start of transaction.

onCommit: could be useful to execute right before commit, finalizing database modifications could be done.

onRollback: this one is really something, since if you go far, there might be something like files uploaded during the entity processing, and you may want to remove them if transaction fails.

Comment by Guilherme Blanco [ 21/May/12 ]

This situation was barely documented here: http://www.doctrine-project.org/jira/browse/DDC-1443

We need a better Transaction API that completely fixes the computation of changesets and also allow more fine grained control over Entities and their corresponding information.

I'd postpone this one until 3.0.





[DDC-1590] Fix Inheritance in Code-Generation Created: 09/Jan/12  Updated: 10/Dec/12

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

Type: Improvement Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 3
Labels: None

Issue Links:
Dependency
is required for DDC-1579 MappedSuperClass and inheritance prob... Resolved

 Comments   
Comment by Lukas Domnick [ 10/Dec/12 ]

(I have no Link Privileges, but this one #DDC-1379 is a duplicate with more extent info.)





[DDC-1574] Support operator 'new' in DQL Created: 30/Dec/11  Updated: 05/Oct/12  Resolved: 05/Oct/12

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

Type: New Feature Priority: Trivial
Reporter: Fabio B. Silva Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   

I know that is a very complex feature,
But would be nice if doctrine DQL get supports for the operator 'new' like hibernate.

http://docs.jboss.org/hibernate/core/4.0/hem/en-US/html/queryhql.html#queryhql-select


class User
{
    /**
     * @Id @Column(type="integer")
     * @GeneratedValue
     */
    public $id;
    /**
     * @Column()
     */
    public $name;
    /**
     * @Column()
     */
    public $email;
    // some code
}

class UserVO
{
    public function __construct($name, $email)
    {
        /// some code
    }
}

//DQL : SELECT new UserVO(u.name, u.email) FROM User u;

RELATED :
DDC-1729



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

It might be even rather simple to implement, but I don't see the use-case tbh.

Comment by Fabio B. Silva [ 31/Dec/11 ]

Hello Benjamin,

This is a well-known hibernate feature, this is very usefull when need to use value/transfer objects whit values from many entities or aggregate functions.
Instead of having a array result from a complex selec with many joins and agragations the result would be used into a simple value object.

I would like to create this feature if some one could give me some tips about the best way to implement this.

Comment by Benjamin Eberlei [ 01/Jan/12 ]

I think the added complexity should not be done before we have value object support in hydrators.

The code to touch here is:

  • ResultSetMapping
  • Abstract-/ObjectHydrator

Please do not attempt this now, i am very unsure about this yet.

Comment by Fabio B. Silva [ 01/Jan/12 ]

I agree with you, we have others important features to do.
Any way I think that would be a usefull feature.

I'll be waiting.

Thanks

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

Fixed by : https://github.com/doctrine/doctrine2/commit/13762f20c9f6daa0c2e4e8a113de01969c6621da





[DDC-1376] Foreign key not available to order when using findBy() Created: 14/Sep/11  Updated: 14/Jan/13  Resolved: 14/Jan/13

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

Type: Improvement Priority: Major
Reporter: Presteus Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   
<?php
/**
 * Service
 *
 * @Entity(repositoryClass="App_Model_Repository_Si_Service")
 * @Table(name="service")
 */
class App_Model_Entities_Si_Service
{
   /**
    * @var int
    *
    * @Id
    * @GeneratedValue(strategy="SEQUENCE")
    * @Column(name="pk", type="integer")
    */
   public $pk;

    /**
     * Service parent
     * @var App_Model_Entities_Si_Service
     *
     * @ManyToOne(targetEntity="App_Model_Entities_Si_Service", cascade={"all"}, inversedBy="service")
     * @JoinColumn(name="pk_service", referencedColumnName="pk")
     */
    private $service;

   /**
    * Returns an App_Model_Entities_Si_Service that represents the service
    *
    * @return App_Model_Entities_Si_Service
    */
   public function getService(){
      return $this->service;
   }
   /**
    * Set an App_Model_Entities_Si_Service that represents a service
    *
    * @param App_Model_Entities_Si_Service $newService
    */
   public function setService($newService){
      $this->service = $newService;
   }
}

$service = $this->service('Service_Type', true);
$serviceType = $service->findOneBy(array('code' => 'service'));
        
$service = $this->service('Service', true);
$services = $service->findBy(
    array('serviceType' => $serviceType->getPk()),
    array('service' => 'ASC')
);

Using orderBy parameter of EntityRepository::findBy() with Foreign Key do not work.
An Unrecognized field error occured.

Of course, i can use DQL but i think this function should work with mapping.

Thank you in advance



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

Not a bug

Comment by Fabio B. Silva [ 14/Jan/13 ]

Fixed : https://github.com/doctrine/doctrine2/commit/b30b06852bc4eacf8bbbed472e1d6ec21310ec0a





[DDC-1283] Possible issue with PersistentCollection#getDelete/InsertDiff() Created: 21/Jul/11  Updated: 20/Sep/12

Status: Reopened
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: 2.1
Fix Version/s: 2.4
Security Level: All

Type: Improvement Priority: Minor
Reporter: Glen Ainscow Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Using the following code, when you go from (1, 2) to (1), (2) is deleted as expected. However, if you go from (1, 2) to (2), (1) and (2) are deleted and (2) is then inserted. Is this the desired behaviour? (i.e. 2 extra queries)

$bracket->getTournamentLocations()->takeSnapshot();

$col = $bracket->getTournamentLocations()->unwrap();

$col->clear();

foreach ($form->getValue('tournamentLocations') as $id) {
    $col->add($em->getReference('Tournaments_Model_TournamentLocation', $id));
}

$bracket->getTournamentLocations()->setDirty(true);


 Comments   
Comment by Benjamin Eberlei [ 26/Jul/11 ]

First, you are using internal API therefore you are on your own anyways.

This is marked as improvment now, the functionality works, it may just be inefficient.

Comment by Guilherme Blanco [ 09/Dec/11 ]

Hi,

I'm marking issue as invalid because you're conceptually wrong.
What you're trying to do is telling that a collection of new entities is holded by a collection of Persistent entities.
The reference internally of PersistentCollection to ArrayCollection means a lot here.

Correct code would be you to regenerate the collection (a new ArrayCollection) and just assign it to setTournamentLocations($newCollection);

Does this explanation is enough for you?

Cheers,

Comment by Glen Ainscow [ 23/Dec/11 ]

Hi Guilherme,

If I do this:

$locations = new ArrayCollection();

foreach ($form->getValue('tournamentLocations') as $id) {
    $locations->add($em->getReference('Tournaments_Model_TournamentLocation', $id));
}

$bracket->setTournamentLocations($locations);

... then all the records are deleted, before adding the new records. This is inefficient and causes extra, unnecessary write operations.

Can't Doctrine perform diffs when persisting the collection, so that only the necessary deletes and inserts are executed?

Comment by Guilherme Blanco [ 13/Jan/12 ]

We could add it, but I don't think it worth the effort.
Main problem with this one is that we use C-level binary comparison to get the diff. That's what you entities/hash pointers are different.
We would have to write our own diff-comparator for both collections, which would probably slowdown the entire Doctrine.

I'd rather consider that it's not possible to be done at the moment, but I need much more investigation for that. This will be something that I'll probably only do when I look at this issue again with a lot of time (which is really hard to happen).

If you have some spare time, feel free to make some attempts.
Just don't forget to enable performance tests in Doctrine Unit Test suite.





[DDC-1245] Check if Entity implements EventSubscriber to allow access to EM Created: 02/Jul/11  Updated: 02/Feb/13  Resolved: 02/Feb/13

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

Type: Improvement Priority: Major
Reporter: Benjamin Eberlei Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   

There is often the feature request that the EM should be accessible in entities when events are triggered.

We should allow entities or repositories to implement EventSubscriber and trigger events accordingly, or find some other scheme to do so.

Currently event subscribers are called for ALL entities, this could lead to a performance increase when only triggering listeners for entities that need them.



 Comments   
Comment by Fabio B. Silva [ 02/Feb/13 ]

fixed : https://github.com/doctrine/doctrine2/commit/71a68a5c6fcd49538c3ef2f86d64bcde1958251c





Generated at Thu Jun 20 02:59:54 UTC 2013 using JIRA 5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5.