[DDC-3596] Do not allow entity column name "decimal" or escape somehow Created: 02/Mar/15  Updated: 02/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: DQL, Mapping Drivers, ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Aurimas Niekis Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Problem is that after creation and schema update of entity with property "decimal" it makes problem to insert and alter that column.

On schema update it uses this SQL to create table:

CREATE TABLE Unit (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, unit VARCHAR(255) NOT NULL, `decimal` SMALLINT NOT NULL, decimal_point VARCHAR(1) NOT NULL, thousands_separator VARCHAR(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;

When trying to persist entity I get exception

  [Doctrine\DBAL\DBALException]
  An exception occurred while executing 'INSERT INTO Unit (name, unit, decimal, decimal_point, thousands_separator) VALUES (?, ?, ?, ?, ?)' with params ["Cubic meters", "m\u00b3", "2", ".", ","]:
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'deci
  mal, decimal_point, thousands_separator) VALUES ('Cubic meters', 'm³', '2',' at line 1

Or alter table to rename column

  [Doctrine\DBAL\DBALException]
  An exception occurred while executing 'ALTER TABLE Unit CHANGE decimal decimal_numbers SMALLINT NOT NULL':
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'deci
  mal decimal_numbers SMALLINT NOT NULL' at line 1





[DDC-3595] [GH-1320] Fix 'entitiy' typo in Getting Started tutorial Created: 02/Mar/15  Updated: 02/Mar/15  Resolved: 02/Mar/15

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

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, getting-started, typo


 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 02/Mar/15 ]

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

Comment by Doctrine Bot [ 02/Mar/15 ]

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





[DDC-3594] [GH-1319] travis: PHP 7.0 nightly added Created: 02/Mar/15  Updated: 02/Mar/15

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

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


 Description   

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

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

Message:






[DDC-3528] [GH-1274] PersistentCollection now extends AbstractLazyCollection. Created: 21/Jan/15  Updated: 01/Mar/15

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

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


 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 22/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 01/Mar/15 ]

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





[DDC-3593] INDEX BY doesnt't work for NEW ArticleDTO Created: 01/Mar/15  Updated: 01/Mar/15

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

Type: Bug Priority: Major
Reporter: Ondřej Vodáček Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

With this query the resulting array is not indexed by id, but from zero

Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
$query = $em->createQuery('SELECT NEW ArticleDTO(a.id, a.title) FROM Article a INDEX BY a.id');
$articles = $query->getResult();





[DDC-3582] Nested embeddables are instantiated with the wrong class Created: 22/Feb/15  Updated: 27/Feb/15

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

Type: Bug Priority: Major
Reporter: Jan Kramer Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Consider the example where an entity contains an embeddable, that itself contains 2 different embeddables. So Entity -> Embeddable 1 -> (Embeddable 2, Embeddable 3). In this case, Embeddable1 will be instantiated as an Embeddable2 for some reason.

Please see https://github.com/jankramer/doctrine2/commit/5e6b02a0fa9a1216b4e4d075061619288af74e7a for a test that demonstrates this and currently fails.

I looked at the code in the ReflectionEmbeddedProperty, and noticed that 'embeddedClass' was recently changed from 'class'. If I change it back, this test passes, but then the ReflectionEmbeddedPropertyTest fails on the scenario for abstract classes. @ocramius, I saw you were the author on that change, could you please take a look? Thanks!



 Comments   
Comment by Jan Kramer [ 22/Feb/15 ]

Closing this as I can't seem to reproduce this issue anymore.

Comment by Jan Kramer [ 24/Feb/15 ]

Now able to reproduce this issue, updated the description.

Comment by Marco Pivetta [ 24/Feb/15 ]

Jan Kramer please send a PR with that diff

Comment by Jan Kramer [ 24/Feb/15 ]

@ocramius See https://github.com/doctrine/doctrine2/pull/1311

Comment by Doctrine Bot [ 27/Feb/15 ]

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

Comment by Doctrine Bot [ 27/Feb/15 ]

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





[DDC-3583] [GH-1309] [DDC-3582] Fix hydration of nested embeddables Created: 22/Feb/15  Updated: 27/Feb/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved 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/1309

Message:

The wrong class is chosen when hydrating embeddables that are part of a nested structure. See `DDC3582Test` for a demonstration. The fix is to use `class` instead of `embeddedClass` to instantiate the embeddable in ReflectionEmbeddedProperty.

The test I removed from ReflectionEmbeddedPropertyTest was failing because you cannot instantiate an abstract class (and rightfully so). However, as this would not be possible in practice anyway (you always end up extending the abstract class), I think this test can be removed safely.



 Comments   
Comment by Doctrine Bot [ 22/Feb/15 ]

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

Comment by Doctrine Bot [ 27/Feb/15 ]

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

Comment by Doctrine Bot [ 27/Feb/15 ]

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





[DDC-3585] [GH-1311] [DDC-3582] Wrong class is instantiated when using nested embeddables Created: 24/Feb/15  Updated: 27/Feb/15  Resolved: 27/Feb/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: embeddables, orm


 Description   

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

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

Message:

Consider the example where an entity contains an embeddable, that itself contains 2 different embeddables. So Entity -> Embeddable 1 -> (Embeddable 2, Embeddable 3). In this case, EmbeddableContainer will be instantiated as an Embeddable1 for some reason.

I looked at the code in the ReflectionEmbeddedProperty, and noticed that 'embeddedClass' was recently changed from 'class'. If I change it back, this test passes, but then the ReflectionEmbeddedPropertyTest fails on the scenario for abstract classes.



 Comments   
Comment by Doctrine Bot [ 27/Feb/15 ]

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

Comment by Doctrine Bot [ 27/Feb/15 ]

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





[DDC-3591] [GH-1317] Respect the "unique" property of the join column on the owning side of a... Created: 27/Feb/15  Updated: 27/Feb/15  Resolved: 27/Feb/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Incomplete Votes: 0
Labels: join, metadata, one-to-one, unique


 Description   

This issue is created automatically through a Github pull request on behalf of ed-at-work:

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

Message:

... One to One association. Coupled with Orphan Removal on the mapped side, this should provide better compatibility for replacing the row without getting duplicate key errors.



 Comments   
Comment by Doctrine Bot [ 27/Feb/15 ]

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





[DDC-1666] orphanRemoval does not work with oneToOne: Duplicate entry Error Created: 23/Feb/12  Updated: 27/Feb/15  Resolved: 14/Mar/13

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

Type: Bug Priority: Major
Reporter: Mario Knippfeld Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 1
Labels: None

Issue Links:
Reference
is referenced by DDC-3592 [GH-1318] Respect the "unique" proper... Open

 Description   

orphanRemoval does not work with oneToOne.
Im getting "duplicate entry" errors after replacing the oneToOne object.
Doctrine seems to insert the new data before removing the old one.
if i remove the unique constraint by hand in the database it works.

Mysql Error
/*
Error:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'UNIQ_9D8DDB05579B502F'
*/
Models and YAML Mapping
/*
Contact:
  type: entity
  table: contact
  fields:
    _id:
      id: true
      type: integer
      unsigned: true
      nullable: false
      generator:
        strategy: AUTO
      column: id
  oneToOne:
    _standingData:
      targetEntity: StandingData
      mappedBy: _contact
      cascade: ["persist", "merge", "remove"] 
      orphanRemoval: true
*/

class Contact
{
    private $_id;
    private $_standingData;

    public function newStandingData(StandingData $sd)
    {
        $this->_standingData = $sd;
        $sd->setContact($this);
    }
}

/*
StandingData:
  type: entity
  table: standing_data
  fields:
    _id:
      id: true
      type: integer
      unsigned: true
      nullable: false
      generator:
        strategy: AUTO
      column: id
  oneToOne:
    _contact:
      targetEntity: Contact
      inversedBy: _standingData
      joinColumns:
        contact_id:
          referencedColumnName: id
          onDelete: cascade
*/

class StandingData
{
    private $_id;
    private $_contact;

    public function setContact(Contact $c)
    {
        $this->_contact = $c;
    }
}
Script
// Create new Contact
$contact = new Contact();
$contact->newStandingData(new \StandingData());
$em->persist($contact);
$em->flush();

// Try to change StandingData
$contact->newStandingData(new \StandingData());
$em->flush();




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

This is a necessary restriction for the internals of Doctrine to always work correctly.

Comment by Albert Casademont [ 12/Apr/12 ]

+1 on this one. So what's the point of orphanRemoval in OneToOne if it can never be done? Maybe onetoones should not create a unique index but a normal one.

If it is really a won't fix, then the docs should reflect that.

Comment by Albert Casademont [ 12/Apr/12 ]

BTW, as a workaround, i suggest converting this OneToOne case (where the orphanRemoval is in the inverse side) into a ManyToOne so a normal index will be created, not a unique one. Then the new row is inserted fine and the old one is deleted afterwards.

Comment by Mario Knippfeld [ 04/May/12 ]

+1
like Albert said, if its really a wont fix, the docs should state that.
the example in: http://readthedocs.org/docs/doctrine-orm/en/latest/reference/working-with-associations.html?highlight=orphan#orphan-removal with a (bidirectional) oneToOne orphanRemoval association isnt working with mysql and having doctrine created the tables.
maybe the bidirectional association is the problem?

Comment by Matthieu Napoli [ 11/Feb/13 ]

+1 same for me

If the example of the docs isn't supposed to work (i.e. orphanRemoval with oneToOne isn't supported), then the docs should be updated.

I can do a PR, but I need you to confirm it's really the case Benjamin Eberlei.

Comment by Benjamin Eberlei [ 14/Mar/13 ]

Its indeed a good fix to disable the unique constraint if orphan removal isset.

Comment by Benjamin Eberlei [ 14/Mar/13 ]

Fixed and merged into 2.3

With the change Doctrine will not create unique indexes anymore on Orphan Removal OneToOne associations. You need to change the database schema for this change to take effect essentially.





[DDC-3592] [GH-1318] Respect the "unique" property of the join column on the owning side of a... Created: 27/Feb/15  Updated: 27/Feb/15

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

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

Issue Links:
Reference
relates to DDC-1666 orphanRemoval does not work with oneT... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of ed-at-work:

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

Message:

... One to One association. Coupled with Orphan Removal on the mapped side, this should provide better compatibility for replacing the row without getting duplicate key errors.






[DDC-3590] [GH-1316] Allow to join non-public schema tables Created: 26/Feb/15  Updated: 26/Feb/15

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

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


 Description   

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

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

Message:

Fix joining non default schema tables in PostgreSQL






[DDC-3588] [GH-1314] DATE_ADD - Support for seconds Created: 25/Feb/15  Updated: 26/Feb/15  Resolved: 26/Feb/15

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

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: custom-dql-function, date-diff, datetime, dql


 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 26/Feb/15 ]

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

Comment by Doctrine Bot [ 26/Feb/15 ]

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





[DDC-3589] [GH-1315] Fixed broken url for implementing Serializable interface Created: 26/Feb/15  Updated: 26/Feb/15  Resolved: 26/Feb/15

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

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, link


 Description   

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

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

Message:

Fixed a broken url for implementing the Serializable interface. The link was pointing to an outdated German version of php.net manual.



 Comments   
Comment by Doctrine Bot [ 26/Feb/15 ]

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

Comment by Doctrine Bot [ 26/Feb/15 ]

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





[DDC-3587] [GH-1313] Added programmatical support to define indexBy on root aliases. Created: 25/Feb/15  Updated: 25/Feb/15  Resolved: 25/Feb/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: index-by, querybuilder


 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 25/Feb/15 ]

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

Comment by Doctrine Bot [ 25/Feb/15 ]

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





[DDC-128] Consider adding EntityManager#link/unlink methods for direct association manipulation Created: 07/Nov/09  Updated: 24/Feb/15

Status: Awaiting Feedback
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.0-ALPHA2
Fix Version/s: 2.x
Security Level: All

Type: New Feature Priority: Major
Reporter: Roman S. Borschel Assignee: Roman S. Borschel
Resolution: Unresolved Votes: 1
Labels: None

Issue Links:
Reference
is referenced by DDC-546 New fetch mode EXTRA_LAZY for collect... Resolved

 Description   

A problem when working with collection-valued associations is that almost all operations except add($obj) require the collection to become initialized in order for the operation to be performed properly. While this is all correct and beautiful OO-wise it may be problematic at times with regards to performance. Hence we might want to consider to provide some convenient methods along the lines of link/unlink (name suggestions?) which allow more direct, less OO collection manipulation. Such methods obviously would bypass the normal object lifecycle and the changes done through these methods will not be reflected in the in-memory objects and collections, unless the user keeps them in-synch himself.



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

Questions

  • I suppose link and unlinked entities would then handled by UnitOfwork commit also?
  • Since the collection is not initialized, one does not know upfront if the action will be successful, what happens if:
    • an entity is linked with a collection, although they are already connected.
    • an entity is unlinked from a collection it is not in.

Regarding the naming, i like link/unlink.

Comment by Roman S. Borschel [ 17/Dec/09 ]

What do you mean by "handled by UnitOfWork commit" ? Whether the SQL is "scheduled" or executed immediately? Interesting question.
Scheduling would probably be better but also more difficult.

As far as usage is concerned, I currently imagine it as follows:

// EntityManager#link($sourceObj, $field, $targetObj)
$user = $em->getReference($userId); // $userId probably from request parameters
$address = $em->getReference($addressId); // $addressId probably from request parameters
$em->link($user, 'addresses', $address);

"What happens if: an entity is linked with a collection, although they are already connected."

Probably an SQL error which results in an exception from the driver. Depends on the database constraints though.

"What happens if: an entity is unlinked from a collection it is not in"

Probably nothing, at least not from the SQL side. An exception could be thrown from Doctrine itself if the update affected 0 rows.

Thanks for these initial questions. Thats definitely food for thought. Keep it coming.

Comment by Roman S. Borschel [ 26/Aug/10 ]

Pushed back.





[DDC-3586] [GH-1312] Add proper pluralization into UpdateCommand Created: 24/Feb/15  Updated: 24/Feb/15  Resolved: 24/Feb/15

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

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


 Description   

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

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

Message:

This alters the UpdateCommand so that if only 1 query is was executed, it will say so.

Rather than "1 queries were executed"



 Comments   
Comment by Doctrine Bot [ 24/Feb/15 ]

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

Comment by Doctrine Bot [ 24/Feb/15 ]

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





[DDC-3341] SessionValidator gives an error message on orderBy association, but it is no error. Created: 07/Oct/14  Updated: 24/Feb/15  Resolved: 24/Feb/15

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

Type: Bug Priority: Minor
Reporter: Tobias Feijten Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: orderBy, orm


 Description   

For @OrderBy annotations, the \Doctrine\ORM\Tools\SchemaValidator only checks if a field with the designated name exists at the designated Entity.
In the case of ordering on an association, defined in the target Entity, this is of course not the case, rendering an error like "The association Idb\TicketBundle\Entity\Ticket#ticketReservations is ordered by a foreign field ticketreservationtype_id that is not a field on the target entity Idb\TicketBundle\Entity\TicketReservation"
However, the \Doctrine\ORM\Persisters\BasicEntityPersister\getOrderBySQL function perfectly supports associations to order on.
Therefore, the error message should not be given when using an association existing at the designated Entity, as it's working and no mistake.
Could this be fixed?



 Comments   
Comment by Marco Pivetta [ 07/Oct/14 ]

Tobias Feijten provide a failing test case to demonstrate the problem first

Comment by Tobias Feijten [ 07/Oct/14 ]

Idb\TicketBundle\Entity\Ticket

namespace Idb\TicketBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

class Ticket {

  /**
   * @ORM\OneToMany(targetEntity="Idb\TicketBundle\Entity\TicketReservation", mappedBy="ticket", cascade={"persist","remove"})
   * @ORM\OrderBy({"ticketReservationType" = "ASC", "amount" = "DESC"})
   */
  private $ticketReservations;

}

Idb\TicketBundle\Entity\TicketReservation

namespace Idb\TicketBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

class TicketReservation {

  /**
   * @ORM\ManyToOne(targetEntity="Idb\TicketBundle\Entity\TicketReservationType")
   * @ORM\JoinColumn(name="ticketreservationtype_id", referencedColumnName="id")
   */
  private $ticketReservationType;

  /**
   * @var integer
   * @ORM\Column(name="amount", type="integer", nullable=false)
   */
  private $amount;

}

The orderBy on amount gives no error when validating the schema, the orderBy on ticketReservationType does (* The association Idb\TicketBundle\Entity\Ticket#ticketReservations is ordered by a foreign field ticketReservationType that is not a field on the target entity Idb\TicketBundle\Entity\TicketReservation).
However, the orderBy statement is not wrong as it is carried out perfectly when using the code.
The only problem is when validating.

Comment by Tobias Feijten [ 13/Oct/14 ]

Marco Pivetta Any progress on this one yet? Or do you need more information?

Comment by Marco Pivetta [ 13/Oct/14 ]

Any progress on this one yet?

No, no progress so far, and I can't allocate time for D2 over the next few weeks.
As for the information amount, it seems sufficient to me: we are probably just using field mappings without checking association mappings when looking for order fields. There is still a problem about what to do with composite identifiers or derived identifiers, but it should be covered by tests first.

Comment by Tobias Feijten [ 24/Jan/15 ]

Marco Pivetta I'm sorry for asking, but still no progress for this ticket? Any ETA? Half a year would be fine (for instance), just keep us up-to-date.

Comment by Marco Pivetta [ 24/Jan/15 ]

Tobias Feijten I honestly worked on a load of other tickets, but not on this one.

If you want an ETA, start looking into it yourself, as I can't pack it into the 2.5 release myself due to time constraints.

Comment by Tobias Feijten [ 24/Feb/15 ]

Fixed in #1146, so can be closed.

Comment by Tobias Feijten [ 24/Feb/15 ]

Fixed in #1149





[DDC-3574] the Paginator does not support arbitrary join should be back ported to 2.4 Created: 19/Feb/15  Updated: 24/Feb/15  Resolved: 19/Feb/15

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

Type: Improvement Priority: Major
Reporter: Sagar Assignee: Marco Pivetta
Resolution: Won't Fix Votes: 0
Labels: paginator


 Description   

Using the following query with the paginator fails:

SELECT u
FROM User u
JOIN Message m WITH m.author = u
WHERE m.status = 'draft' -- a condition justifying the join

The CountWalker and the CountOutputWalker both throw a exception saying "Cannot count query which selects two FROM components, cannot make distinction"

This message is wrong (I can make distinction here. Only User is selected in the result set) and confusing (I spent some time finding the second FROM before figuring it was related to the use of an arbitrary join instead of an association join).



 Comments   
Comment by Sagar [ 19/Feb/15 ]

Though it is fixed in 2.5 "the Paginator does not support arbitrary join should be back ported to 2.4"

Comment by Marco Pivetta [ 19/Feb/15 ]

This is a new feature that won't be backported into stable versions.

Comment by Sagar [ 24/Feb/15 ]

I really don't understand How this is new feature? It is missing part of Pagination Component.

Comment by Marco Pivetta [ 24/Feb/15 ]

It was limitation that was refactored out. Since it's an improvement, it won't land in a patch release.





[DDC-2556] Proxy getId() different code generated when using Trait Created: 16/Jul/13  Updated: 23/Feb/15

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

Type: Bug Priority: Minor
Reporter: Eduardo Oliveira Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: None


 Description   
class Timezone {
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="smallint", nullable=false, options={"unsigned": true})
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * Get id
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }
}

If I replace that code with a Trait with equal code and use it on the entity the proxy will be generated different.

Without trait:

    /**
     * {@inheritDoc}
     */
    public function getId()
    {
       	if ($this->__isInitialized__ === false) {
            return (int)  parent::getId();
        }


       	$this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array());

       	return parent::getId();
    }

With trait:

    /**
     * {@inheritDoc}
     */
    public function getId()
    {

        $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array());

        return parent::getId();
    }

And in this code:

$timezone = $this->timezoneRepository->findReadOnly(
    $campaign->getTimezone()->getId()
);

I get:
Doctrine\ORM\ORMException: The identifier id is missing for a query of EB\Core\KernelBundle\Entity\Common\Timezone

$campaign->getTimezone()->getId()
Is returning null.

About the findReadOnly is just a wrapper that will fetch from cache if not there fetch from DB, anyway if I change it to find() exact same problem

My versions of doctrine:

$ php composer.phar show -i | grep doctrine
doctrine/annotations                   v1.1.2             Docblock Annotations Parser
doctrine/cache                         v1.0               Caching library offering an object-oriented API for many cache backends
doctrine/collections                   v1.1               Collections Abstraction library
doctrine/common                        2.4.0-RC4          Common Library for Doctrine projects
doctrine/data-fixtures                 dev-master 6924952 Data Fixtures for all Doctrine Object Managers
doctrine/dbal                          2.4.0-RC2          Database Abstraction Layer
doctrine/doctrine-bundle               v1.2.0             Symfony DoctrineBundle
doctrine/doctrine-fixtures-bundle      dev-master 512fc0f Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle    dev-master 5fc1167 Symfony DoctrineMigrationsBundle
doctrine/inflector                     v1.0               Common String Manipulations with regard to casing and singular/plural rules.
doctrine/lexer                         v1.0               Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                    dev-master ced3b41 Database Schema migrations using Doctrine DBAL
doctrine/orm                           2.4.0-RC2          Object-Relational-Mapper for PHP
gedmo/doctrine-extensions              v2.3.6             Doctrine2 behavioral extensions
stof/doctrine-extensions-bundle        dev-master 6577f23 Integration of the gedmo/doctrine-extensions with Symfony2


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

Is the problem here the repository or just the trait method?

Can you please clean up the issue to insulate only the affected part? What is `getId` returning on that kind of object?

Comment by Eduardo Oliveira [ 16/Jul/13 ]

Marco I will try to do better, I will try to do make a test case that proves this.

But i can leave here already more info:

  • There is an entity Campaign that have a Timezone (ManyToOne in Campaign side);
  • This entity Campaign is fetch (with lazy in all associations) and serialized and put in cache;
  • This entity Campaign don't have timezone itself, but $campaign->getTimezone()->getId() hit the return (int) parent::getId(); on proxy not making any query to get the timezone, in the case with trait the proxy code is different and it returns null
Comment by Marco Pivetta [ 16/Jul/13 ]

Eduardo Oliveira is the proxy in a detached state when you do this? What happens if (with an existing identifier) you do following?

var_dump($entityManager->getReference('Timezone', 123)->getId());
Comment by Eduardo Oliveira [ 16/Jul/13 ]
var_dump ( $this->timezoneRepository->getEM()->getReference('EBCoreKernelBundle:Common\Timezone', 1)->getId() ); // 1

Marco yes is on detached mode, and I know that, I'm relying on the proxy to get the ID, because I don't want any queries being "issued", so I'm doing like

$campaign = $campaignRepository->findReadOnly(10); // hit cache
$timezoneRepository->findReadOnly($campaign->getTimezone()->getId() /* rely on proxy */); // hit memcache

This just work in the last versions of Doctrine that have lazy getId(), but it looks that for traits something wrong happens on the generation of Proxy.

If on Entity timezone I use the trait but override the getId() everything works perfect again.

Comment by Marco Pivetta [ 16/Jul/13 ]

Eduardo Oliveira does this also happen with 2.3.x? (asking because the proxy generation logic was rewritten for 2.4)

Comment by Eduardo Oliveira [ 16/Jul/13 ]

2.3 the proxy is quite different but the essence of the problem remains:

Proxy with trait (doesn't work, because as far as I know will try to make a query in detach mode):

    public function getId()
    {
        $this->__load();
        return parent::getId();
    }

Proxy without trait (works well):

    public function getId()
    {
        if ($this->__isInitialized__ === false) {
            return (int) $this->_identifier["id"];
        }
        $this->__load();
        return parent::getId();
    }
Comment by Marco Pivetta [ 16/Jul/13 ]

Ok, so at least I now know it's not an issue with the upgrade, but it was also borked before. Thanks for following along till here: I'll work on a patch as soon as I have time.

Comment by Thomas Ploch [ 23/Feb/15 ]

@ocramius

This just got a little bit hotter for us. We moved all our ID related code into a trait that is shared by most our entities. After deploying that we saw a dramatic rise in small id based queries to the database, which is related to this bug here.

We had to revert the changes for now, but I'd be happy to work on a fix if there still is a need.

Regards
Thomas

Comment by Thomas Ploch [ 23/Feb/15 ]

See http://www.doctrine-project.org/jira/browse/DCOM-276





[DDC-3584] [GH-1310] Allow symfony 3.0 components Created: 22/Feb/15  Updated: 22/Feb/15

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

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


 Description   

This issue is created automatically through a Github pull request on behalf of nicolas-grekas:

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

Message:

Tests should tell if any deprecated interfaces of Symfony are used. If not, then the bundle is defacto compatible with 3.0






[DDC-3581] DatabaseDriver does not assert nullable on ToOne associationMappings Created: 21/Feb/15  Updated: 21/Feb/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers, Tools
Affects Version/s: 2.4.7
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Ryan Korczykowski Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I am using the DatabaseDriver/AnnotationExporter to tweak class generation and found that JoinColumn annotations did not contain nullable=false even when the local FK column was not null. This is counter-intuitive since nullable on Column annotations is properly handled.

Here is a simple fix that checks the column of the local column in DatabaseDriver::buildToOneAssociationMappings:

for ($i = 0; $i < count($fkColumns); $i++) {
    $associationMapping['joinColumns'][] = array(
        'name'                 => $fkColumns[$i],
        'referencedColumnName' => $fkForeignColumns[$i],
        //fix here
        'nullable' => !$foreignKey->getLocalTable()->getColumn($fkColumns[$i])->getNotNull()
    );
}

Given that the database defines null / not null on FK columns, the JoinColumn nullable attribute should not be left undefined.






[DDC-3577] Inherited associations are ignored Created: 20/Feb/15  Updated: 20/Feb/15

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

Type: Bug Priority: Major
Reporter: Denis Vasilev Assignee: Steve Müller
Resolution: Unresolved Votes: 0
Labels: schematool


 Description   

Could not create schema via SchemaTool for entity, which has inherited accosiation mapping (this mapping is ignored).

ShemaTool.php
private function gatherRelationsSql($class, $table, $schema, &$addedFks, &$blacklistedFks)
{
    foreach ($class->associationMappings as $mapping) {
        if (isset($mapping['inherited'])) {
            continue;
        }
...

I have three entity types:

  • BaseType — mapping mapped-superclass, has association many-to-one, join-column pid
  • SecondType extends BaseType — mapping entity
  • ThirdType extends SecondType — mapping entity

Table for ThirdType not has pid column after created scheme via SchemeTool. Inheritance mapping not using.



 Comments   
Comment by Marco Pivetta [ 20/Feb/15 ]

This should actually be working: you probably need to provide a test case otherwise

Comment by Denis Vasilev [ 20/Feb/15 ]

https://github.com/yethee/doctrine2/commit/d55a8bc71381db1c599da682c4baca0ce39d0d62
Test case for this issue.

$ phpunit --group=DDC-3577
PHPUnit 4.7-g7c1de6a by Sebastian Bergmann and contributors.

Configuration read from D:\Projects\doctrine2\phpunit.xml.dist

F

Time: 1.97 seconds, Memory: 81.75Mb

There was 1 failure:

1) Doctrine\Tests\ORM\Tools\SchemaToolTest::testInheritedAssociationShouldBeSupported
Table "ddc3577_interviews" should has column "user_id".
Failed asserting that false is true.




[DDC-3580] [GH-1308] [DDC-3579] Allow override of inversedBy Created: 20/Feb/15  Updated: 20/Feb/15

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

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


 Description   

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

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

Message:






[DDC-3579] Allow override of inversedBy Created: 20/Feb/15  Updated: 20/Feb/15

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

Type: New Feature Priority: Minor
Reporter: z38 Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: inheritance


 Description   

If an entity inherits a many-to-many relationship it is sometimes desirable to be allowed to override inversedBy. This way bi-directional relationships can exist without code duplication. For examples, check out this and this Stackoverflow question.

The proposed pull-request implements this feature. I'm open to any comments and suggestions. Please just let me know if this feature is opposed to any concepts/practices, I'm not sure whether the feature is needed by anyone else.






[DDC-3575] Paginator's CountOutputWalker keeps the ORDER BY in the subquery for all non-MSSQL platforms Created: 20/Feb/15  Updated: 20/Feb/15

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

Type: Bug Priority: Major
Reporter: John Flatness Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: paginator

Issue Links:
Reference
relates to DDC-3519 [GH-1267] Failing test for an ORDER B... Resolved
relates to DDC-3538 [GH-1283] #1267 - order by broken in ... Resolved

 Description   

The Paginator's CountOutputWalker leaves the ORDER BY clause in the subquery that's executed to get the total count.

The original (and current) version of that code included the following comment:

Note that the ORDER BY clause is not removed. Many SQL implementations (e.g. MySQL) are able to cache subqueries. By keeping the ORDER BY clause intact, the limitSubQuery that will most likely be executed next can be read from the native SQL cache.

My understanding is that MySQL does not, in fact, cache subqueries in the query cache, so cached results are not available between executions of different queries. The current MySQL manual still states that "Queries that are a subquery of an outer query" are not cached.

This pull request was merged in 2013 to address errors with mssql and paginating ordered queries. Midway through the discussion on that issue, it was determined that it would be better to just remove the ORDER BY clause for all platforms, not just MS SQL. However, that decision was reversed when it came time to merge the PR.

Does the comment on that method accurately describe the rationale for retaining the ORDER BY clause for the count query? If so, am I simply wrong about how MySQL operates, or does the comment refer to some other platform that benefits from this pattern?



 Comments   
Comment by Marco Pivetta [ 20/Feb/15 ]

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

This change was reverted because MSSQL is pretty much a niche, and fixing bugs for it is really making things complicated for all the other storages.

Comment by John Flatness [ 20/Feb/15 ]

Thanks for the reply, Marco.

I think this is getting conflated with the other Paginator-related ORDER BY changes and reversions that have happened breaking and fixing the actual sorting behavior. The pull you linked looks like its relating to the LimitSubqueryOutputWalker, not the CountOutputWalker.

The thing I'm talking about is still there, and does specifically address only a MSSQL bug: https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Pagination/CountOutputWalker.php#L82

The particular part of the discussion on PR #572 I was referring to above is here: https://github.com/doctrine/doctrine2/pull/572#discussion_r3154962

My concern is that the rationale for keeping the ORDER BY intact for all the other platforms (only when running the count query, not the "real" one) is a performance-related one, and that it's a flawed rationale. (Or, at least, that the comment about it is.)





[DDC-2988] Notice: Undefined index: joinColumns in BasicEntityPersister.php Created: 19/Feb/14  Updated: 20/Feb/15

Status: Awaiting Feedback
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: 2.3.5, 2.4.2, 2.4.7
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Dennis Væversted Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 3
Labels: None

Attachments: Text File undefined-joinColumn.patch    
Issue Links:
Duplicate
duplicates DDC-2808 Notice: Undefined index: joinColumns ... Resolved
Reference
is referenced by DDC-3578 [GH-1307] Test for DDC-2988 Open

 Description   

When trying to use findBy on a ManyToMany field i receive the error:

Notice: Undefined index: joinColumns in lib/Doctrine/ORM/Persisters/BasicEntityPersister.php

It seems to be caused internally by the code expecting 'joinColumns' to be directly on the association, however it is found under 'joinTable'.
I have attached a patch that atleast fixes my case, hopefully it can be used to pin-point what the error is.



 Comments   
Comment by Dennis Væversted [ 19/Feb/14 ]

Might be related to this one: http://www.doctrine-project.org/jira/browse/DDC-2808

Comment by Litz Ouille [ 28/May/14 ]

Doctrine ORM 2.4.2 Here.

Here are my annotations
https://gist.github.com/LitzOuille/3cf2e73e169c032147ea

The thing I'm trying to do is
$questionRepository->findBy(array('contacts' => $ids)); // $ids = array(1,2,3, ...)

Comment by Marco Pivetta [ 30/May/14 ]

Calin Pristavu did you validate your mappings?

Comment by Calin Pristavu [ 30/May/14 ]

I failed, sorry.
The error came from the many-to-many condition in the entity.
Sorry for generating confusion, comment deleted !

The many-to-one works just fine !

Comment by Litz Ouille [ 03/Jun/14 ]

A little feedback? Is this a bug? Can it be fixed?
Thanks

Comment by Marco Pivetta [ 03/Jun/14 ]

Litz Ouille that particular repository call cannot work. How are we supposed to find an entity from a list of associated IDs? It would have to be the exact match...

Assuming that API would work as I envision it, it looks like a missing feature.

Dennis Væversted in order to accept a patch, we first need a failing test case demonstrating the failing scenario.

Comment by Litz Ouille [ 03/Jun/14 ]

EDIT: Ok my bad.

I am using findBy(array('id', $arrayIds)) and it is working. I thought I was using on a ManyToOne relationship, but no.

EDIT2: @ocramius In fact I would like to find all questions for which the contacts' list contains at least one id. Something like
SELECT q.*
FROM Question q, QuestionContact qc //qc = jointable
WHERE q.id = qc.question_id
AND qc.contact_id IN ($ids)

EDIT3: Actually when I try to findBy('ManyToMany', $id), it does not work either. I think I will have to use a repository for every query using a ManyToMany relationship.

EDIT4: Ok, so, as said in the original post, findBy does not work with many-to-many.
Notice: Undefined index: joinColumns (BasicEntityPersister.php line 1666)
Dump($this->class->associationMappings[$field]): https://gist.github.com/LitzOuille/51929fdc3eda5576ed31

Comment by Xander ten Boden [ 13/Jun/14 ]

I've got the same issue, also running doctrine 2.4.2:

multiple users can have multiple departments:

/**
 * @ORM\ManyToMany(targetEntity="CartelAuthDepartment", inversedBy="users")
 * @ORM\JoinTable(name="cartel_auth_user_has_cartel_auth_department",
 *		joinColumns={@ORM\JoinColumn(name="cartel_auth_user_id", referencedColumnName="id")},
 *		inverseJoinColumns={@ORM\JoinColumn(name="cartel_auth_department_id", referencedColumnName="id")}
 * )
 */
private $departments;

/**
 * @ORM\ManyToMany(targetEntity="\Cartel\AuthBundle\Entity\CartelAuth\CartelAuthUser", mappedBy="departments")
 */
private $users;

Then I want to find all the users that are within the departments that the current user has:

$aAuthUsers = $oEm->getRepository('CartelAuthBundle:CartelAuth\CartelAuthUser')->findByDepartments($aAuthDepartments);

This results in this error:

Notice: Undefined index: joinColumns in .../vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 1665

Comment by Alexander [ 29/Jan/15 ]

I have same problem with doctrine 2.4.7:

Acme\ProjectBundle\Entity\Employee:
  manyToMany:
    projectbag:
      targetEntity: ProjectBag
      mappedBy: bagemployee
Acme\ProjectBundle\Entity\ProjectBag:
  manyToMany:
    bagemployee:
          targetEntity: Employee
          inversedBy: projectbag
          joinTable:
            name: ProjectBag_Employee
            joinColumns:
              ProjectBag_id:
                referencedColumnName: id
            inverseJoinColumns:
              Employee_id:
                referencedColumnName: id

$em->getRepository('AcmeProjectBundle:ProjectBag')->findBy(array('bagemployee'=>$em->getRepository('AcmeProjectBundle:Employee')->find(828)));

Notice: Undefined index: joinColumns in vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php at line 1670

Comment by George Brooks [ 06/Feb/15 ]

What is meant by "Awaiting feedback"?

After encountering the same error as described above I've created a new Symfony project with the sole purpose of reproducing the error. If this would be of use in resolving the issue please let me know. I can make the code available in whatever form would be the most useful.

Comment by Marco Pivetta [ 06/Feb/15 ]

in order to accept a patch, we first need a failing test case demonstrating the failing scenario.

We don't need a symfony project or an example app: we have our own test suite that can be found at https://github.com/doctrine/doctrine2/tree/master/tests

Comment by Carl Boisvert [ 13/Feb/15 ]

I have the same issue. Want to filter on a relationship on the owning side (Because I got an error on the non owning side saying I needed to be on the owning side) and I get the exact same error.

Comment by Ilya Antipenko [ 19/Feb/15 ]

As workaround we can collect IDs and pass it to queryBuilder, like:

    public function findAllSwitcherTypeByComponents($components)
    {
        $ids = [];
        /** @var Component $component */
        foreach ($components as $component) {
            $ids[] = $component->getId();
        }

        $query = $this->createQueryBuilder('component_switcher_type');
        $query
            ->join( 'component_switcher_type.components', 'components', 'WITH', $query->expr()->in('components.id', $ids));

        return $query->getQuery()->getResult();
}
Comment by Marco Pivetta [ 19/Feb/15 ]

Don't code workarounds: provide a test case, so that a patch can be created

Comment by Ilya Antipenko [ 19/Feb/15 ]

I'll this ASAP.

Comment by Ilya Antipenko [ 20/Feb/15 ]

Here is the test: https://github.com/doctrine/doctrine2/pull/1307
Here is the test log on travis-ci: https://travis-ci.org/aivus/doctrine2/builds/51516067





[DDC-3578] [GH-1307] Test for DDC-2988 Created: 20/Feb/15  Updated: 20/Feb/15

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

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

Issue Links:
Reference
relates to DDC-2988 Notice: Undefined index: joinColumns ... Awaiting Feedback

 Description   

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

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

Message:

This test can be merged only after fix issue DDC-2988

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






[DDC-3519] [GH-1267] Failing test for an ORDER BY that is INNER JOINed in a subquery Created: 19/Jan/15  Updated: 20/Feb/15  Resolved: 24/Jan/15

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

Type: Bug Priority: Critical
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: limit, limitsubqueryoutputwalker, orderBy, orderby, paginator, subquery

Issue Links:
Duplicate
duplicates DDC-3538 [GH-1283] #1267 - order by broken in ... Resolved
Reference
is referenced by DDC-3575 Paginator's CountOutputWalker keeps t... Open

 Description   

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

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

Message:

A failing test case to demonstrate a problem with #1220.

cc: @Ocramius @zeroedin-bill, @mvrhov, @stof, @brianium, @mrkrstphr



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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





[DDC-3538] [GH-1283] #1267 - order by broken in pagination logic (reverts #1220) Created: 24/Jan/15  Updated: 20/Feb/15  Resolved: 24/Jan/15

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

Type: Bug Priority: Critical
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: limitsubqueryoutputwalker, orderBy, orderby, paginator, subquery

Issue Links:
Duplicate
is duplicated by DDC-3519 [GH-1267] Failing test for an ORDER B... Resolved
Reference
is referenced by DDC-3575 Paginator's CountOutputWalker keeps t... Open

 Description   

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

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

Message:

This PR reverts #1220 and merges #1264



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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





[DDC-3576] [GH-1306] Add support for array hydrator in interface ObjectRepository of Doctrine... Created: 20/Feb/15  Updated: 20/Feb/15  Resolved: 20/Feb/15

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

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: object-repository, repository


 Description   

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

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

Message:

.../Common github repo

with magic function

  • findArrayResultBy
  • findOneArrayResultBy


 Comments   
Comment by Doctrine Bot [ 20/Feb/15 ]

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

Comment by Doctrine Bot [ 20/Feb/15 ]

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





[DDC-2794] the Paginator does not support arbitrary join Created: 14/Nov/13  Updated: 19/Feb/15  Resolved: 22/Sep/14

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

Type: Improvement Priority: Major
Reporter: Christophe Coevoet Assignee: Marco Pivetta
Resolution: Fixed Votes: 3
Labels: paginator

Issue Links:
Dependency
depends on DDC-3233 [GH-1092] Arbitrary Join count walker... Resolved

 Description   

Using the following query with the paginator fails:

SELECT u
FROM User u
JOIN Message m WITH m.author = u
WHERE m.status = 'draft' -- a condition justifying the join

The CountWalker and the CountOutputWalker both throw a exception saying "Cannot count query which selects two FROM components, cannot make distinction"

This message is wrong (I can make distinction here. Only User is selected in the result set) and confusing (I spent some time finding the second FROM before figuring it was related to the use of an arbitrary join instead of an association join).



 Comments   
Comment by Pierre-Antoine Pinel [ 23/Dec/13 ]

Hi,

I have the same issue.

My query is : SELECT entity FROM W\XBundle\Entity\X entity LEFT JOIN Z\YBundle\Entity\Y y WITH y.x = entity LEFT JOIN y.v v WHERE v.name LIKE :like

Is there a way to fix this issue ? I really need this to work with the Paginator.

Best,

Comment by Christophe Coevoet [ 23/Dec/13 ]

Why changing the status to "Awaiting feedback" ? It is not waiting for a feedback of the reporter to check the fix. It is an open ticket which does not have a fix yet

Comment by Glen Ainscow [ 30/Sep/14 ]

Is this going to be back-ported to 2.4.x?

Comment by Marco Pivetta [ 01/Oct/14 ]

No, this is actually a new supported feature: I'm changing the issue type.

Comment by Sagar [ 19/Feb/15 ]

This issue should be back-ported to 2.4.x as this seems not just new supported feature but should be present in 2.4 as improvements or fix.





[DDC-3572] Versionable behavior does not work Created: 18/Feb/15  Updated: 18/Feb/15  Resolved: 18/Feb/15

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

Type: Bug Priority: Minor
Reporter: Pascal Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: orm

Attachments: Zip Archive doctrine2-versionable-bug.zip    

 Description   

I tried to set up a versionable example (see attachment). The problem is. It works random. Sometimes the old record will be submitted into the _version table. Sometimes it doesn't. Most of the time the version stay 1 in the _version table. Sometimes it works as it should. I hardly can't believe that I setup something wrong because of the random bugs.

I face the same problem which is described in the comment of the updated sample code here: http://www.doctrine-project.org/jira/browse/DDC-871?focusedCommentId=14702&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14702



 Comments   
Comment by Marco Pivetta [ 18/Feb/15 ]

Doctrine ORM 2.x does not provide a versionable behavior.





[DDC-3573] DateTime objects casted to string when used in aggregate functions in query results Created: 18/Feb/15  Updated: 18/Feb/15

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

Type: Bug Priority: Major
Reporter: Ameer Antar Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: dbal, mysql, orm, querybuilder
Environment:

MySQL, possibly others



 Description   

Similar to DDC-657: http://www.doctrine-project.org/jira/browse/DDC-657

DateTime objects are converted to strings when selecting them through an aggregate function.

Example:

Update.php Column definition
    /**
     * @var \DateTime
     * @ORM\Column(name="entryDate", type="datetime")
     */
    private $entryDate;
Query Builder
		$qb = $this->getEntityManager()->createQueryBuilder();
		$qb->select('u.code, max(u.entryDate) as updateDate');
		$qb->from('Update', 'u');
		$qb->addGroupBy('u.code');

		var_dump( $qb->getQuery()->getResult() );

The result contains the date/times as strings not DateTime objects as expected. This affects the query builder. I assume it also affects DQL queries.






[DDC-3561] Wrong SQL generated for Drop Foreign Key on MySQL Created: 06/Feb/15  Updated: 18/Feb/15

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

Type: Bug Priority: Major
Reporter: Stefan Gnann Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

operating system: osx yosemite
database driver: pdo_mysql
installed bundles:
doctrine/annotations v1.2.3
doctrine/cache v1.4.0
doctrine/collections v1.2
doctrine/common v2.4.2
doctrine/data-fixtures dev-master ac36ccc
doctrine/dbal v2.5.1
doctrine/doctrine-bundle v1.3.0
doctrine/doctrine-cache-bundle v1.0.1
doctrine/doctrine-fixtures-bundle v2.2.0
doctrine/doctrine-migrations-bundle dev-master 81575a4
doctrine/inflector v1.0.1
doctrine/instantiator 1.0.4
doctrine/lexer v1.0.1
doctrine/migrations dev-master 96f838b
doctrine/mongodb 1.1.6
doctrine/mongodb-odm dev-master 23152aa
doctrine/mongodb-odm-bundle dev-master 9748d11
doctrine/orm v2.4.7
gedmo/doctrine-extensions v2.3.9
stof/doctrine-extensions-bundle v1.1.0


Attachments: File migrate-example.php    

 Description   

i´m new to doctrine, but it seems to me that there is a problem creating statements in migrations.
Please see the //comments in the attached file!



 Comments   
Comment by Marco Pivetta [ 06/Feb/15 ]

Steve Müller I think I saw this issue already in the DBAL tracker somewhere, but I can't find it. Do you remember the issue ID?

Comment by Stefan Gnann [ 06/Feb/15 ]

The attached file was automatically generated after upgrading doctrine/dbal onto version 2.5.1 .

Now i have DOWNgraded doctrine/dbal to version 2.4.4 .
Suddenly the doctrine:migrations:diff says "No changes detected in your mapping information.".

Before downgrading i had two identical databases. One locally installed and one in a vagrant box with debian as os.
On every database i did a "doctrine:migrations:diff" to generate an actual schema update file. What i was wondering ist, that i got two different files with different ALTER xxxxx statements regarding to FOREIGN KEY and INDEXES.

Maybe this is a bug in doctrine/dbal 2.5.1?

Comment by Stefan Gnann [ 06/Feb/15 ]

actual installed bundles after downgrading:

doctrine/annotations v1.2.3
doctrine/cache v1.4.0
doctrine/collections v1.2
doctrine/common v2.4.2
doctrine/data-fixtures dev-master 80401e8
doctrine/dbal v2.4.4
doctrine/doctrine-bundle v1.3.0
doctrine/doctrine-cache-bundle v1.0.1
doctrine/doctrine-fixtures-bundle v2.2.0
doctrine/doctrine-migrations-bundle dev-master 81575a4
doctrine/inflector v1.0.1
doctrine/instantiator 1.0.4
doctrine/lexer v1.0.1
doctrine/migrations dev-master 1ac14fa
doctrine/mongodb 1.1.7
doctrine/mongodb-odm dev-master 1343375
doctrine/mongodb-odm-bundle dev-master 27e7690
doctrine/orm v2.4.7
gedmo/doctrine-extensions v2.3.11
stof/doctrine-extensions-bundle v1.1.0

Comment by Peter Rehm [ 18/Feb/15 ]

Steve Müller I did some research on that the last days and I am sure, there is still a major issue with the implementation.

The schema update creates the following sql commands:

$this->addSql('ALTER TABLE Article DROP FOREIGN KEY FK_12743CF7924C3225');
$this->addSql('ALTER TABLE Article DROP FOREIGN KEY FK_12743CF79395C3F3');
$this->addSql('ALTER TABLE Article DROP FOREIGN KEY FK_12743CF7F7C5BCDB');
$this->addSql('ALTER TABLE Article DROP FOREIGN KEY FK_93173F21A23B42D');
$this->addSql('ALTER TABLE Article DROP FOREIGN KEY FK_93173F21A5790FE9');
$this->addSql('ALTER TABLE Article ADD CONSTRAINT FK_12743CF7924C3225 FOREIGN KEY (createdUser_id) REFERENCES CoreUser (id)');

Looking at the previous SQL schema I found out that there is already e.g. the FK_12743CF7924C3225. This FK
will be dropped and newly added at the same time. It is actually not using the new FK name which doctrine would
like to see. However in the down sql it tried to drop the key which should be there.

In addition to that there is an issue with upper/lowercase Index names. This I got fixed by

return 'DROP INDEX ' . strtoupper($indexName) . ' ON ' . $table;

in MysqlPlatform:860 which is most likely not the right way. I am more concerned about the FK
issue, which I am unable to track down so far. Do you have any idea?





[DDC-3571] Alter ResultSetMapping on NEW DQL (typeMapping for newObjectMappings) Created: 17/Feb/15  Updated: 17/Feb/15

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

Type: Documentation Priority: Minor
Reporter: Ignace Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 0
Labels: None


 Description   

In the documentation it says that with the NEW operator only scalars are passed but it is limited to only string? Or is it possible to hint it to return floats and integers aswell?

Currently I hacked this together:

private function getIncomeOutgoingPerMonthQuery($year, &$rsm)
    {
        $rsm = new ResultSetMapping();
        $rsm->addScalarResult('sclr0', 'amount_sum', 'integer');

        return $this->createQueryBuilder('t')
            ->select('NEW AppBundle\ValueObject\Money(SUM(t.amount), t.currency), SUBSTRING(t.date, 6, 2) AS HIDDEN month')
            ->where('SUBSTRING(t.date, 1, 4) = :year')
            ->groupBy('t.currency')
            ->addGroupBy('month')
            ->setParameter('year', (int)$year);
    }





[DDC-3570] [GH-1305] Documentation : fix table prefix with STI Created: 16/Feb/15  Updated: 16/Feb/15  Resolved: 16/Feb/15

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

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: ddl, documentation, listener, metadata, schema, table-prefix


 Description   

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

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

Message:

If an Entity use STI, it gets its table name from the parent class. In this case, we need to check that the class is the root class of the hierarchy when adding prefix, otherwise children class are prefixed twice.



 Comments   
Comment by Doctrine Bot [ 16/Feb/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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





[DDC-3569] [GH-1304] Documentation : fix table prefix with STI Created: 16/Feb/15  Updated: 16/Feb/15  Resolved: 16/Feb/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Incomplete Votes: 0
Labels: sti, table, table-prefix


 Description   

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

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

Message:

If an Entity use STI, it gets its table name from the parent class. We need to check that a class is a root class of the hierarchy when adding prefix, otherwise children class are double prefixed.



 Comments   
Comment by Doctrine Bot [ 16/Feb/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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





[DDC-3568] Discriminator column in joined multiple inheritance Created: 16/Feb/15  Updated: 16/Feb/15  Resolved: 16/Feb/15

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

Type: Bug Priority: Major
Reporter: Glend Gjermeni Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: discriminator-map
Environment:

Ubuntu 14.04LTS, PHP 5.5, MySQL 5.5.41-0ubuntu0.14.04.1



 Description   

I'm facing an issue when trying to use multiple inheritance via discriminators. When generating a schema, only the superclass has a discriminator column.

See my test case: https://github.com/anooxy/doctrine-multiple-inheritance-test

The hierarchy is supposed to be (inheriting order):

TutorContact -> TutorStudentChildrenContact -> Contact
StudentContact -> StudentChildrenContact -> TutorStudentChildrenContact & StudentParentContact -> Contact
ParentContact -> StudentParentContact -> Contact
ChildrenContact -> StudentChildrenContact -> TutorStudentChildrenContact -> Contact

Only Contact table has a discriminator column, whereas the middle tables, which have been assigned a discriminator in the annotations, do not have one.



 Comments   
Comment by Marco Pivetta [ 16/Feb/15 ]

This is the expected behavior: only the root of the inheritance has the discriminator column.





[DDC-3460] SchemaTool create unnecessry work by trying to set foreign keys on MyISAM tables Created: 20/Dec/14  Updated: 16/Feb/15

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

Type: Bug Priority: Major
Reporter: flack Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 1
Labels: None


 Description   

When I run SchemaTool::getSchemaFromMetadata, it always adds foreign keys constraints for all association fields (in SchemaTool::gatherRelationJoinColumns). Since I've set the table's engine option to 'MyISAM', this is quite pointless, since they won't get created anyways.

When I run SchemaManager::createSchema, it does not detect any foreign keys, so the SchemaDiff from Comparator will contain a large number of (pointless) ADD CONSTRAINT FK_xxx FOREIGN KEY commands.

For the moment, I work around this by removing them in a ToolEvents::postGenerateSchemaTable listener, but shouldn't SchemaTool be able to detect this situation itself?



 Comments   
Comment by flack [ 16/Feb/15 ]

This says "awaiting feedback" now. Is there any question that I can answer?

Comment by Marco Pivetta [ 16/Feb/15 ]

I think this is a "won't fix", as we don't consider MyISAM as supported.

The "awaiting feedback" flag was mainly because tests are missing.

Comment by Steve Müller [ 16/Feb/15 ]

I think we fixed that already in DBAL 2.5: https://github.com/doctrine/dbal/commit/e95afefab614ecb352791cf09fd5f831d7e5b3be





[DDC-3461] [GH-1229] Identity in onetoone association builder Created: 23/Dec/14  Updated: 16/Feb/15  Resolved: 16/Feb/15

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

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: association, metadata, metadata-builder


 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 23/Dec/14 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 26/Jan/15 ]

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

Comment by Doctrine Bot [ 26/Jan/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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





[DDC-3564] [GH-1301] Add failing test with ToOne SL2 association Created: 11/Feb/15  Updated: 16/Feb/15

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

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


 Description   

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

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

Message:

Hi,

This failing test is based on @FabioBatSilva tests here (https://github.com/FabioBatSilva/doctrine2/blob/4f7e71963f5197235fce9f87a56b02bbbba46026/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheOneToOneTest.php).

I've changed the test so that on Token association, there is no @Cache annotation.

The default behaviour would be to Doctrine set a proxy on non-cached association. Instead, it basically creates a "partial" object where any associations without the @Cache is set to null. I'm pretty sure it works the same ManyToOne association too.



 Comments   
Comment by Doctrine Bot [ 16/Feb/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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





[DDC-3566] [GH-1302] Store column values of not cache-able associations Created: 11/Feb/15  Updated: 16/Feb/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved 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/1302

Message:

Fixes #1301



 Comments   
Comment by Doctrine Bot [ 16/Feb/15 ]

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





[DDC-3554] [GH-1295] Fix join when recreation of query from parts. Created: 01/Feb/15  Updated: 16/Feb/15  Resolved: 16/Feb/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: clone, join, query, querybuilder


 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 16/Feb/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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





[DDC-3550] [GH-1293] EntityManager::__cosntruct() as public method Created: 28/Jan/15  Updated: 16/Feb/15

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

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


 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 16/Feb/15 ]

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





[DDC-3258] [GH-1113] Added support for composite primary key on findBy methods and Criteria Created: 18/Aug/14  Updated: 16/Feb/15  Resolved: 16/Feb/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM, Second Level Cache
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: association, associationKey, composite-identifier, persister, second-level-cache

Issue Links:
Duplicate
is duplicated by DDC-3260 [GH-1114] Composite pk break test Resolved
is duplicated by DDC-3316 [GH-1141] Always allow proxies on ToO... Resolved

 Description   

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

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

Message:

Hi!
I tried to implement the matching of entities that uses composite primary keys...

Any suggestion?



 Comments   
Comment by Doctrine Bot [ 22/Oct/14 ]

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

Comment by Doctrine Bot [ 18/Jan/15 ]

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

Comment by Doctrine Bot [ 18/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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





[DDC-3259] Second level & UnitOfWork inconsistencies Created: 19/Aug/14  Updated: 16/Feb/15

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

Type: Improvement Priority: Major
Reporter: Asmir Mustafic Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: second-level-cache


 Description   

Hi!

I have a lot of entities with entity associations as keys and I'm trying to use second level cache.

Looking at the method: UnitOfWork::createEntity($className, array $data, &$hints = array())

  • $className: contains the class name
  • $data: contains the raw data (the row coming from the database)

Enabling the second level cache, DefaultQueryCache::get calls the createEntity method passing a $data that contains object entities and some raw data (https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Cache/DefaultQueryCache.php#L155).

I think that DefaultQueryCache should not introduce a variant of $data and should create a compatible version of $data.



 Comments   
Comment by Marco Pivetta [ 19/Aug/14 ]

Asmir Mustafic do you have any example of where this may be happening?

Comment by Asmir Mustafic [ 19/Aug/14 ]

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

This is the same branch of https://github.com/doctrine/doctrine2/pull/1113, plus this commit (https://github.com/goetas/doctrine2/commit/bfbbb9123fd28f7fa053b76895eaa77e00095aa6) that simply involves the second level cache too.
Travis should fail soon.

Comment by Doctrine Bot [ 19/Aug/14 ]

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

Comment by Asmir Mustafic [ 19/Aug/14 ]

Here the failure https://travis-ci.org/doctrine/doctrine2/jobs/32972996#L402

Comment by Doctrine Bot [ 22/Oct/14 ]

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

Comment by Doctrine Bot [ 18/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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





[DDC-2879] Persisting collections with Composite Primary Keys composed of 2 Foreign Keys and one metadata field Created: 31/Dec/13  Updated: 16/Feb/15

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

Type: Bug Priority: Major
Reporter: Dylan Johnson Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: composite, identity, mapping, orm, postgresql
Environment:

Ubuntu 13.04 and PostgresSQL 9.1.0 on Vagrant Virtual Machine running an application with Symfony2 backend and JavaScript client



 Description   

SYNOPSIS

Bug prevents persisting a collection of entities in a join table with a Composite Primary
Key made up of 2 Foreign Keys and one metadata field. From these mapping instructions:
http://docs.doctrine-project.org/en/latest/tutorials/composite-primary-keys.html#use-case-3-join-table-with-metadata

ISSUE DETAILS

SUCCESS: When FOREIGN KEY 1 is the same across items in a collection to be persisted, and FOREIGN KEY 2 is greater than FOREIGN KEY 2 in any existing PRIMARY KEY, the entity and collection are persisted correctly

    • Example: GPA "add val below" exists and has assessment value
      {"grade_point_average_id":1,"assessment_id":1,"value":4}

      We will try to add a new assessment value where assessment_id > that of any existing assessment value for GPA "add val below"

    • Request Payload:
      {"name":"Add Val Below","courses":[],"assessmentValues":[{"assessment":1,"value":4},{"assessment":3,"value":2}]}
    • Debug Log:
      [2014-01-07 11:48:01] app.INFO: START GRADE_POINT_AVERAGE_REPOSITORY #SAVE [GPA #GET_NAME =ADD VAL BELOW] [] []
      [2014-01-07 11:48:01] app.INFO:   BEGIN OUTPUT FOR GRADE POINT AVERAGE Add Val Below - ASSESSMENT VALUE 1 [] []
      [2014-01-07 11:48:01] app.INFO:         ASSESSMENT_VALUE #GET_GRADE_POINT_AVERAGE #GET_ID: 1 [] []
      [2014-01-07 11:48:01] app.INFO:         GRADE_POINT_AVERAGE #GET_ID: 1 [] []
      [2014-01-07 11:48:01] app.INFO:         ASSESSMENT_VALUE #GET_ASSESSMENT #GET_ID: 1 [] []
      [2014-01-07 11:48:01] app.INFO:         ASSESSMENT_VALUE #GET_VALUE: 4 [] []
      [2014-01-07 11:48:01] app.INFO:         MANAGED? 1 [] []
      [2014-01-07 11:48:01] app.INFO:   END OUTPUT FOR GRADE POINT AVERAGE Add Val Below - ASSESSMENT VALUE 2 [] []
      [2014-01-07 11:48:01] app.INFO:   BEGIN OUTPUT FOR GRADE POINT AVERAGE Add Val Below - ASSESSMENT VALUE 2 [] []
      [2014-01-07 11:48:01] app.INFO:         ASSESSMENT_VALUE #GET_GRADE_POINT_AVERAGE #GET_ID: 1 [] []
      [2014-01-07 11:48:01] app.INFO:         GRADE_POINT_AVERAGE #GET_ID: 1 [] []
      [2014-01-07 11:48:01] app.INFO:         ASSESSMENT_VALUE #GET_ASSESSMENT #GET_ID: 3 [] []
      [2014-01-07 11:48:01] app.INFO:         ASSESSMENT_VALUE #GET_VALUE: 2 [] []
      [2014-01-07 11:48:01] app.INFO:         MANAGED?  [] []
      [2014-01-07 11:48:01] app.INFO:   END OUTPUT FOR GRADE POINT AVERAGE Add Val Below - ASSESSMENT VALUE 3 [] []
      [2014-01-07 11:48:01] app.INFO: END GRADE_POINT_AVERAGE_REPOSITORY #SAVE [GPA #GET_NAME =ADD VAL BELOW] [] []
      [2014-01-07 11:48:01] doctrine.DEBUG: "START TRANSACTION" [] []
      [2014-01-07 11:48:01] doctrine.DEBUG: INSERT INTO gpa_assessment_value (point_value, grade_point_average_id, assessment_id) VALUES (?, ?, ?) {"1":2,"2":"1","3":"3"} []
      [2014-01-07 11:48:01] doctrine.DEBUG: UPDATE gpa_assessment_value SET point_value = ? WHERE grade_point_average_id = ? AND assessment_id = ? [4,1,1] []
      [2014-01-07 11:48:01] doctrine.DEBUG: "COMMIT" [] []

FAILURE: When FOREIGN KEY 1 is the same across items in a collection, and FOREIGN KEY 2 is less than any existing FOREIGN KEY 2, the unit of work tries to INSERT existing entity and does not operate on new entity. The EntityManager thinks it contains() the new entity, but not the old one

    • Example: GPA "add val above" exists and has assessment value
      {"assessment":3,"value":2}

      We will try to add a new assessment value where assessment_id < that of any existing assessment value for GPA "add val above"

    • Request Payload:
      {"name":"Add Val Above","courses":[],"assessmentValues":[{"assessment":1,"value":4},{"assessment":3,"value":2}]}
    • Debug log:
      [2014-01-07 11:47:09] app.INFO: START GRADE_POINT_AVERAGE_REPOSITORY #SAVE [GPA #GET_NAME =ADD VAL ABOVE] [] []
      [2014-01-07 11:47:09] app.INFO:   BEGIN OUTPUT FOR GRADE POINT AVERAGE Add Val Above - ASSESSMENT VALUE 1 [] []
      [2014-01-07 11:47:09] app.INFO:         ASSESSMENT_VALUE #GET_GRADE_POINT_AVERAGE #GET_ID: 2 [] []
      [2014-01-07 11:47:09] app.INFO:         GRADE_POINT_AVERAGE #GET_ID: 2 [] []
      [2014-01-07 11:47:09] app.INFO:         ASSESSMENT_VALUE #GET_ASSESSMENT #GET_ID: 1 [] []
      [2014-01-07 11:47:09] app.INFO:         ASSESSMENT_VALUE #GET_VALUE: 4 [] []
      [2014-01-07 11:47:09] app.INFO:         MANAGED? 1 [] []
      [2014-01-07 11:47:09] app.INFO:   END OUTPUT FOR GRADE POINT AVERAGE Add Val Above - ASSESSMENT VALUE 2 [] []
      [2014-01-07 11:47:09] app.INFO:   BEGIN OUTPUT FOR GRADE POINT AVERAGE Add Val Above - ASSESSMENT VALUE 2 [] []
      [2014-01-07 11:47:09] app.INFO:         ASSESSMENT_VALUE #GET_GRADE_POINT_AVERAGE #GET_ID: 2 [] []
      [2014-01-07 11:47:09] app.INFO:         GRADE_POINT_AVERAGE #GET_ID: 2 [] []
      [2014-01-07 11:47:09] app.INFO:         ASSESSMENT_VALUE #GET_ASSESSMENT #GET_ID: 3 [] []
      [2014-01-07 11:47:09] app.INFO:         ASSESSMENT_VALUE #GET_VALUE: 2 [] []
      [2014-01-07 11:47:09] app.INFO:         MANAGED?  [] []
      [2014-01-07 11:47:09] app.INFO:   END OUTPUT FOR GRADE POINT AVERAGE Add Val Above - ASSESSMENT VALUE 3 [] []
      [2014-01-07 11:47:09] app.INFO: END GRADE_POINT_AVERAGE_REPOSITORY #SAVE [GPA #GET_NAME =ADD VAL ABOVE] [] []
      [2014-01-07 11:47:09] doctrine.DEBUG: "START TRANSACTION" [] []
      [2014-01-07 11:47:09] doctrine.DEBUG: INSERT INTO gpa_assessment_value (point_value, grade_point_average_id, assessment_id) VALUES (?, ?, ?) {"1":2,"2":"2","3":"3"} []
      [2014-01-07 11:47:09] doctrine.DEBUG: "ROLLBACK" [] []
      [2014-01-07 11:47:09] event.DEBUG: Notified event "kernel.exception" to listener "Symfony\Component\Security\Http\Firewall\ExceptionListener::onKernelException". [] []
      [2014-01-07 11:47:09] event.DEBUG: Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelException". [] []
      [2014-01-07 11:47:09] event.DEBUG: Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ExceptionListener::onKernelException". [] []
      [2014-01-07 11:47:09] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\DBALException: "An exception occurred while executing 'INSERT INTO gpa_assessment_value (point_value, grade_point_average_id, assessment_id) VALUES (?, ?, ?)' with params [2, "2", "3"]:
      
      SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates unique constraint "gpa_assessment_value_pkey"
      DETAIL:  Key (grade_point_average_id, assessment_id)=(2, 3) already exists." at /vagrant/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php line 47 {"exception":"[object] (Doctrine\\DBAL\\DBALException: An exception occurred while executing 'INSERT INTO gpa_assessment_value (point_value, grade_point_average_id, assessment_id) VALUES (?, ?, ?)' with params [2, \"2\", \"3\"]:\n\nSQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates unique constraint \"gpa_assessment_value_pkey\"\nDETAIL:  Key (grade_point_average_id, assessment_id)=(2, 3) already exists. at /vagrant/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:47, PDOException: SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates unique constraint \"gpa_assessment_value_pkey\"\nDETAIL:  Key (grade_point_average_id, assessment_id)=(2, 3) already exists. at /vagrant/vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php:138)"} []
         

CODE

migration.sql
CREATE TABLE assessment
(
    id       bigserial NOT NULL,
    scale_id bigint    NOT NULL,
    title    varchar   NOT NULL,
    passing  boolean   NOT NULL,
    rank     int,

    PRIMARY KEY (id)
);

CREATE TABLE assessment_scale
(
    id   bigserial NOT NULL,
    name varchar   NOT NULL,

    PRIMARY KEY (id)
);

-- ...

CREATE TABLE grade_point_average
(
    id                         bigserial       NOT NULL,
    name                       varchar         NOT NULL,
    additional_credit_allowance numeric(4, 2),

    PRIMARY KEY (id)
);

-- ...

CREATE TABLE gpa_assessment_value
(
    grade_point_average_id bigint        NOT NULL,
    assessment_id          bigint        NOT NULL,
    point_value            numeric(4, 2) NOT NULL,

    PRIMARY KEY (assessment_id, grade_point_average_id),
    FOREIGN KEY (assessment_id) REFERENCES assessment,
    FOREIGN KEY (grade_point_average_id) REFERENCES grade_point_average
);
GradePointAverage.php
<?php
namespace LGSConnect\Model;

use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Column;
//...
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use LGSConnect\Util\ConstructorArgs;
use LGSConnect\Model\GradePointAverage\AssessmentValue;
// ...

/**
 * @Entity("LGSConnect\Repository\GradePointAverageRepository")
 */
class GradePointAverage
{
    // GradePointAverage Model (owning side): a tool for evaluating a student's performance 
    // by dividing the total points earned by total credits attempted.

    use ConstructorArgs;

    /**
     * @Id
     * @GeneratedValue
     * @Column(type="bigint")
     *
     * @var int
     */
    private $id;

    // ...

    /**
     * @OneToMany(targetEntity="LGSConnect\Model\GradePointAverage\AssessmentValue", mappedBy="gradePointAverage", cascade="persist")
     *
     * @var Collection
     */
    private $assessmentValues;
    
    // ...

    /**
     * @param array $args
     */
    public function __construct(array $args = [])
    {
        $this->assessmentValues = new ArrayCollection;
        // ...
        $this->handleArgs($args);
    }
    
    // ...
    
    /**
     * @return Collection
     */
    public function getAssessmentValues()
    {
        return $this->assessmentValues;
    }

    /**
     * @param ArrayCollection $assessmentValues
     */
    public function setAssessmentValues(ArrayCollection $assessmentValues)
    {
        $this->assessmentValues = $assessmentValues;
    }

    /**
     * @param AssessmentValue $assessmentValue
     */
    public function addAssessmentValue(AssessmentValue $assessmentValue)
    {
        $this->assessmentValues->add($assessmentValue);
    }

    /**
     * @param AssessmentValue $assessmentValue
     */
    public function removeAssessmentValue(AssessmentValue $assessmentValue)
    {
        $this->assessmentValues->removeElement($assessmentValue);
    }
    
    // ...
}
AssessmentValue.php
<?php
namespace LGSConnect\Model\GradePointAverage;

use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\JoinColumn;
use LGSConnect\Model\GradePointAverage;
use LGSConnect\Model\Assessment;
use LGSConnect\Util\ConstructorArgs;

/**
 * @Entity("LGSConnect\Repository\GradePointAverage\AssessmentValueRepository")
 * @Table("gpa_assessment_value")
 */
class AssessmentValue
{
    // AssessmentValue Model (inverse side): a number of points assigned 
    // to an Assessment by a Grade Point Average

    use ConstructorArgs;

    /**
     * @Id
     * @ManyToOne(targetEntity="LGSConnect\Model\GradePointAverage")
     */
    private $gradePointAverage;

    /**
     * @Id
     * @ManyToOne(targetEntity="LGSConnect\Model\Assessment")
     */
    private $assessment;

    /**
     * @Column("point_value")
     *
     * @var float
     */
    private $value;

    /**
     * @param array $args
     */
    public function __construct(array $args = [])
    {
        $this->handleArgs($args);
    }

    /**
     * @return GradePointAverage
     */
    public function getGradePointAverage()
    {
        return $this->gradePointAverage;
    }

    /**
     * @param GradePointAverage $gradePointAverage
     */
    public function setGradePointAverage(GradePointAverage $gradePointAverage)
    {
        $this->gradePointAverage = $gradePointAverage;
    }

    /**
     * @return Assessment
     */
    public function getAssessment()
    {
        return $this->assessment;
    }

    /**
     * @param Assessment $assessment
     */
    public function setAssessment(Assessment $assessment)
    {
        $this->assessment = $assessment;
    }

    /**
     * @return float
     */
    public function getValue()
    {
        return $this->value;
    }

    /**
     * @param float $value
     */
    public function setValue($value)
    {
        $this->value = $value;
    }

    /**
     * @return AssessmentScale
     */
    public function getAssessmentScale()
    {
        return $this->assessment->getScale();
    }
}
Assessment.php
<?php
namespace LGSConnect\Model;

use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\ManyToOne;
use LGSConnect\Model\Assessment\Scale;
use LGSConnect\Util\ConstructorArgs;

/**
 * @Entity("LGSConnect\Repository\AssessmentRepository")
 */
class Assessment
{
    // Assessment (related, but unmapped): A "grade" assigned to a student 
    // for attending a course section

    use ConstructorArgs;

    /**
     * @Id
     * @GeneratedValue
     * @Column(type="bigint")
     *
     * @var int
     */
    private $id;
    
    // ...

    /**
     * @param array $args
     */
    public function __construct(array $args = [])
    {
        $this->handleArgs($args);
    }

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }
    
    // ...
}
GradePointAverageRepository.php
<?php
namespace LGSConnect\Repository;

use Doctrine\ORM\EntityRepository;
// ...
use LGSConnect\Model\GradePointAverage;

class GradePointAverageRepository extends BaseRepository implements GradePointAverageRepositoryInterface
{
    // ...

    /**
     * @param GradePointAverage $gradePointAverage
     */
    public function save(GradePointAverage $gradePointAverage)
    {
        $this->getEntityManager()->persist($gradePointAverage);
        $this->getEntityManager()->flush();
    }
}
AssessmentValueRepository.php
<?php
namespace LGSConnect\Repository\GradePointAverage;

use Doctrine\ORM\EntityRepository;
use LGSConnect\Model\GradePointAverage\AssessmentValue;

class AssessmentValueRepository extends EntityRepository
{
    /**
     * @param AssessmentValue $assessmentValue
     */
    public function save(AssessmentValue $assessmentValue)
    {
        $this->getEntityManager()->persist($assessmentValue);
        $this->getEntityManager()->flush();
    }
}
GradePointAverageManager.php
<?php
namespace LGSConnect\Manager;

use InvalidArgumentException;
use Symfony\Component\Validator\ValidatorInterface;
use JMS\DiExtraBundle\Annotation\Service;
use JMS\DiExtraBundle\Annotation\InjectParams;
use JMS\SecurityExtraBundle\Annotation\PreAuthorize;
use Knp\Component\Pager\Pagination\PaginationInterface;
use LGSConnect\Repository\GradePointAverageRepository;
use LGSConnect\PaginationFactory\GradePointAveragePaginationFactoryInterface;
use LGSConnect\Model\GradePointAverage;

/**
 * @Service("grade_point_average_manager")
 */
class GradePointAverageManager
{
    /**
     * @var GradePointAverageRepository
     */
    private $gradePointAverageRepository;

    /**
     * @var GradePointAveragePaginationFactoryInterface
     */
    private $gradePointAveragePaginationFactory;

    /**
     * @var ValidatorInterface
     */
    private $validator;

    /**
     * @InjectParams
     *
     * @param GradePointAverageRepository $gradePointAverageRepository
     * @param GradePointAveragePaginationFactoryInterface $gradePointAveragePaginationFactory
     * @param ValidatorInterface $validator
     */
    public function __construct(
        GradePointAverageRepository $gradePointAverageRepository,
        GradePointAveragePaginationFactoryInterface $gradePointAveragePaginationFactory,
        ValidatorInterface $validator
    )
    {
        $this->gradePointAverageRepository = $gradePointAverageRepository;
        $this->gradePointAveragePaginationFactory = $gradePointAveragePaginationFactory;
        $this->validator = $validator;
    }

    /**
     * @PreAuthorize("isAllowedToManageTheGradePointAverage(#gradePointAverage)")
     * @param GradePointAverage $gradePointAverage
     * @throws InvalidArgumentException
     */
    public function save(GradePointAverage $gradePointAverage)
    {
        $violationList = $this->validator->validate($gradePointAverage);
        if ($violationList->count()) {
            throw new InvalidArgumentException;
        }

        $this->gradePointAverageRepository->save($gradePointAverage);
    }
}
GradePointAverageController.php
<?php
namespace LGSConnect\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Doctrine\Common\Collections\ArrayCollection;
use FOS\RestBundle\View\View;
use JMS\DiExtraBundle\Annotation\Service;
use JMS\DiExtraBundle\Annotation\InjectParams;
use JMS\SecurityExtraBundle\Annotation\PreAuthorize;
use Knp\Component\Pager\Pagination\PaginationInterface;
use LGSConnect\Manager\GradePointAverageManager;
use LGSConnect\Model\GradePointAverage;
use LGSConnect\Model\GradePointAverage\AssessmentValue;

/**
 * @Service("grade_point_average_controller", parent="lgs.controller.abstract")
 * @Route("/gpa", service="grade_point_average_controller")
 */
class GradePointAverageController extends BaseController
{
    /**
     * @var GradePointAverageManager
     */
    private $gradePointAverageManager;

    private $logger;

    /**
     * @InjectParams
     *
     * @param GradePointAverageManager $gradePointAverageManager
     * @param LoggerInterface $logger
     */
    public function __construct(GradePointAverageManager $gradePointAverageManager, LoggerInterface $logger)
    {
        $this->gradePointAverageManager = $gradePointAverageManager;
        $this->logger = $logger;
    }
    
    // ...

    /**
     * @Route("/{id}", name="gpa.edit", requirements={"id" = "\d+"})
     * @Method("PUT")
     *
     * @param Request $request
     * @param GradePointAverage $gpa
     * @return View
     */
    public function editAction(Request $request, GradePointAverage $gpa)
    {
        $form = $this->formFactory->createNamed(null, 'gpa', $gpa, [
            'method' => 'PUT',
        ]);
        $form->handleRequest($request);

        foreach ($gpa->getAssessmentValues() as $av) {
            $this->logger->info('GPA ID PREVALIDATE IN CONTROLLER:'.$gpa->getId());
            $this->logger->info('PREVALIDATE IN CONTROLLER ASSESSMENT VAL ASSESSMENT ID:'.$av->getAssessment()->getId());
            $this->logger->info('PREVALIDATE IN CONTROLLER ASSESSMENT VAL POINTS:'.$av->getValue());
        }

        /*
        // try reversing the order of the collection to see if that helps
        $assessmentVals = $gpa->getAssessmentValues()->toArray();
        $reversed = array_reverse($assessmentVals);
        $reversedColl = new ArrayCollection($reversed);
        $gpa->setAssessmentValues($reversedColl);
        */

        if ($form->isValid()) {
            foreach ($gpa->getAssessmentValues() as $av) {
                $this->logger->info('GPA ID PRESAVE IN CONTROLLER:'.$gpa->getId());
                $this->logger->info('PRESAVE IN CONTROLLER ASSESSMENT VAL ASSESSMENT ID:'.$av->getAssessment()->getId());
                $this->logger->info('PRESAVE IN CONTROLLER ASSESSMENT VAL POINTS:'.$av->getValue());
            }
            $this->gradePointAverageManager->save($gpa);

            return new View($gpa, 204);
        }

        return new View($form);
    }

    // ...
}
GradePointAverageType.php
<?php
namespace LGSConnect\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use JMS\DiExtraBundle\Annotation\FormType;

/**
 * @FormType
 */
class GradePointAverageType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name')
            ->add('courses', 'entity', [
                'class' => 'Model:Course',
                'multiple' => true
            ])
            ->add('assessmentValues', 'collection', [
                'type' => 'gpa_assessment_value',
                'allow_add' => true,
                'by_reference' => false,
            ])
        ;
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'gpa';
    }
}
AssessmentValueType.php
<?php
namespace LGSConnect\Form\Type\GradePointAverage;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use JMS\DiExtraBundle\Annotation\FormType;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

/**
 * @FormType("gpa_assessment_value")
 */
class AssessmentValueType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('assessment', 'entity', [
                'class' => 'Model:Assessment',
            ])
            ->add('value', 'number', [
                'precision' => 2,
            ])
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults([
            'data_class' => 'LGSConnect\Model\GradePointAverage\AssessmentValue',
        ]);
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'gpa_assessment_value';
    }
}


 Comments   
Comment by Valentin Nazarov [ 23/Jan/15 ]

Any update on this issue? We've got same problem in our project (PostgreSQL 9.4, Doctrine 2.4.7)

Comment by Marco Pivetta [ 24/Jan/15 ]

Removed the "feedback required" flag.

Valentin Nazarov if there is no ticket update, well... then there is no actual update.

Somewhat related to https://github.com/doctrine/doctrine2/pull/1113

I suggest getting your hands dirty and fixing it yourself if it affects you.

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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





[DDC-3560] [GH-1300] [2.4] #1169 DDC-3343 one-to-omany persister deletes only on EXTRA_LAZY plus orphanRemoval Created: 05/Feb/15  Updated: 16/Feb/15  Resolved: 16/Feb/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, ORM
Affects Version/s: 2.4.7
Fix Version/s: 2.4.8
Security Level: All

Type: Bug Priority: Blocker
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: extra-lazy, onetomany, orphanRemoval, persistent-collection, persister

Issue Links:
Dependency
is required for DDC-3343 `PersistentCollection::removeElement`... Resolved

 Description   

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

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

Message:

As per #1169 and DDC-3343 ( http://www.doctrine-project.org/jira/browse/DDC-3343 ), `EXTRA_LAZY` `PersistentCollection#removeElement()` calls should only affect the database if `orphanRemoval=true` is specified in the mappings.

Otherwise, being the `one-to-many` the inverse side, no action should be performed.



 Comments   
Comment by Doctrine Bot [ 05/Feb/15 ]

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

Comment by Doctrine Bot [ 05/Feb/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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





[DDC-3536] [GH-1281] Hotfix/#1169 extra lazy one to many should not delete referenced entities Created: 24/Jan/15  Updated: 16/Feb/15  Resolved: 25/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, ORM
Affects Version/s: Git Master, 2.3.5, 2.4.7
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Blocker
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: delete, extra-lazy, onetomany, update

Issue Links:
Dependency
depends on DDC-3544 [GH-1288] Hotfix - #1169 - extra lazy... Resolved
is required for DDC-3343 `PersistentCollection::removeElement`... Resolved

 Description   

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

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

Message:

This is an alternate fix for #1169 (DDC-3343 http://www.doctrine-project.org/jira/browse/DDC-3343)



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 25/Jan/15 ]

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

Comment by Doctrine Bot [ 05/Feb/15 ]

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

Comment by Doctrine Bot [ 05/Feb/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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

Comment by Doctrine Bot [ 16/Feb/15 ]

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





[DDC-3391] RFC Allow adding extra metadata attributes Created: 13/Nov/14  Updated: 15/Feb/15

Status: Awaiting Feedback
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Minor
Reporter: Gonzalo Vilaseca Assignee: Marco Pivetta
Resolution: Unresolved Votes: 1
Labels: drivers, metadata


 Description   

What I'd like to propose is a way of having custom metadata in ClassMetadata.

So the current problem is this: I want to add custom tags to doctrine metadata files, and then get this tags on a loadClassMetadata listener in order to modify the mapping.
Currently the only workaround is parsing this custom tags in the loadClassMetadata listener, going through all the files again.

I was thinking of having a new 'extra' array field in ClassMetadata, every time a driver parses a configuration, throw a new event with the read configuration (being xml, yaml...etc.). A custom listener will parse it looking for the custom tags and return an array that will be added to the 'extra' array field in ClassMetadata.

Then, on the loadClassMetadata listener we retrieve this 'extra' configuration information, and modify the mapping as we want.

Does this make sense?



 Comments   
Comment by Gonzalo Vilaseca [ 14/Nov/14 ]

Ideally instead of the 'extra' array field, it would be nice to easily extend Metadata class so that the new values are filled in the new extended Metadata class.

Comment by Christophe Coevoet [ 14/Nov/14 ]

This would be even worse. If the recommended way for extensions is to extend the Doctrine Metadata object to add their field, it means you can only use 1 extension at a time (because you cannot use the extended class of both extensions at the same time for the same object).
This is why it is much better for other libraries to store their own metadata in their own object instead of trying to put it inside the Doctrine ones.

I'm not even sure putting custom tags inside the Doctrine mapping file is the best solution. It may be better to use a separate metadata file for the mapping of the other library (just like you use a different mapping file for the Symfony validation mapping even if it applies to the same class than the Doctrine mapping for instance)

Comment by Gonzalo Vilaseca [ 14/Nov/14 ]

You're right regarding the metadata.

As for the separate files, validation in Symfony is not doctrine specific, that's why it's in a separate file. If you have a look at some doctrine extensions like ``Prezent translable`` or ``Doctrine2 behavioral extensions``, the natural location for the custom tags are the Doctrine mapping files as they are specific to doctrine, by looking at just one file you see the whole picture.

Yes, you could have your own mapping files, but then you would need to do some Symfony magic to be able to load them, and this is what would be nice to avoid.

I think of it as a way to easily extend doctrine mapping capabilities, in a 'plugin' way.

I'm currently working on a i18n bundle for Symfony, the tags I add in doctrine mapping files create associations between entities and their translations: I've had to create quite a few compiler passes for my current project to work as desired, and I see no way of abstracting this in a general way, it will need to be application specific. If I could hook into the Doctrine workflow and get those tags to populate my metadata class, that would be great, simple and reusable.

Comment by Gonzalo Vilaseca [ 19/Nov/14 ]

I've come out with another use case:
I need some custom metadata when the repository is instantiated, AFAIK there is no way of doing this right now, or is there?

Comment by Marco Pivetta [ 19/Nov/14 ]

You'd use a different metadata factory for that, specific to your use-case.
Mixing ORM mappings with the rest will just cause more coupling between the ORM and the userland use-case.

Comment by Michał Dobaczewski [ 15/Feb/15 ]

As Gonzalo Vilaseca metioned without ability to set custom metadata attributes in ClassMetadata there is no proper way to obtain custom metadata in repository class. For example popular DoctrineDxtensions written by Gediminas Morkevicius obtain custom metadata by looping throught event subscribers (https://github.com/Atlantic18/DoctrineExtensions/blob/master/lib/Gedmo/Sortable/Entity/Repository/SortableRepository.php). By the way, shame that Doctrine has no API for extensions.





[DDC-3556] [GH-1297] [DDC-3480] Docs: Embeddable supported mappings Created: 03/Feb/15  Updated: 14/Feb/15  Resolved: 14/Feb/15

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

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, embeddables, mapping

Issue Links:
Reference
is referenced by DDC-3480 ORM\Embeddable does not create ManyTo... Open

 Description   

This issue is created automatically through a Github pull request on behalf of eugene-dounar:

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

Message:

Mention that only basic mapping is supported by embeddables



 Comments   
Comment by Doctrine Bot [ 14/Feb/15 ]

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

Comment by Doctrine Bot [ 14/Feb/15 ]

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





[DDC-3557] [GH-1298] Docs: Remove empty pages from TOC Created: 03/Feb/15  Updated: 14/Feb/15  Resolved: 14/Feb/15

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

Type: Documentation Priority: Trivial
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, rst


 Description   

This issue is created automatically through a Github pull request on behalf of eugene-dounar:

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

Message:

Remove Installation page from TOC as it was moved to "Installation and Configuration"



 Comments   
Comment by Doctrine Bot [ 14/Feb/15 ]

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

Comment by Doctrine Bot [ 14/Feb/15 ]

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

Comment by Doctrine Bot [ 14/Feb/15 ]

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





[DDC-3567] [GH-1303] make QueryBuilder::getAllAliases public Created: 14/Feb/15  Updated: 14/Feb/15

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

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


 Description   

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

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

Message:

Being able to get all already defined aliases in the QueryBuilder can be helpful when dynamically joining.

Funny, the DocBlock makes it seem as if this method was already public.






[DDC-3565] "Missing value for primary key" error using JoinColumns Created: 11/Feb/15  Updated: 11/Feb/15

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

Type: Bug Priority: Minor
Reporter: Arran Walker Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: orm


 Description   

With a ManyToOne relationship to a composite foreign key and using JoinColumns, I get this error during hydration of the Branch entity when it has no associated primary Contact:

Missing value for primary key user on Contact

If there is an associated Contact, it works as expected.

I think it's related to this error on StackOverflow.

User.php
<?php

/**
 * @Entity()
 */
class User
{
    /**
     * @Id @Column(type="integer") @GeneratedValue
     */
    protected $id;

    /**
     * @Column(type="string")
     */
    protected $name;

    public function __construct($name)
    {
        $this->name = $name;
    }

    public function getId()
    {
        return $this->id;
    }
}
Branch.php
<?php

use Doctrine\Common\Collections\ArrayCollection;

/**
 * @Entity
 */
class Branch
{
    /**
     * @Id @Column(type="integer") @GeneratedValue
     */
    protected $id;

    /**
     * ORM\OneToMany(targetEntity="Contact", mappedBy="Branch", cascade={"persist", "remove"}, indexBy="user")
     */
    protected $contacts;

    /**
     * @ManyToOne(targetEntity="Contact")
     * @JoinColumns(
     *   @JoinColumn(name="primary_contact_user_id", referencedColumnName="user_id"),
     *   @JoinColumn(name="id", referencedColumnName="branch_id")
     * )
     */
    protected $primaryContact;

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

    public function addUserAsContact(User $user)
    {
        if (!$this->contacts[$user->getId()]) {
            $this->contacts[$user->getId()] = new Contact($this, $user);
        }

        return $this->contacts[$user->getId()];
    }

    public function setUserAsPrimaryContact(User $user)
    {
        $this->primaryContact = $this->addUserAsContact($user);
    }
}
Branch.php
<?php


/**
 * @Entity
 */
class Contact
{
    /**
     * @Id()
     * @ManyToOne(targetEntity="Branch")
     * @JoinColumn(name="branch_id", referencedColumnName="id", nullable=false)
     */
    protected $branch;

    /**
     * @Id()
     * @ManyToOne(targetEntity="User")
     * @JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
     */
    protected $user;

    public function __construct(Branch $branch, User $user)
    {
        $this->branch = $branch;
        $this->user   = $user;
    }

    public function getUser()
    {
        return $this->user;
    }
}





[DDC-3382] With orphanRemoval, cannot delete and re-add entity Created: 10/Nov/14  Updated: 10/Feb/15  Resolved: 10/Nov/14

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

Type: Bug Priority: Major
Reporter: Christian Schmidt Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: None


 Description   

I have a one-to-many relation with orphanRemoval=true.

If I remove an entity from the related collection and add it back, the entity is removed from the database.

$employee = $company->getEmployees()->first();
$company->getEmployees()->removeElement($employee);
$company->getEmployees()->add($employee);

$em->persist($company);
$em->flush();
// Now $employee is deleted from the database.

The expected behaviour is to leave the entity in the database, because it was present in the PersistentCollection when $em->persist() was called.



 Comments   
Comment by Marco Pivetta [ 10/Nov/14 ]

This is expected behavior, and won't be changed for now.

Comment by Dmitriy Shashkin [ 10/Feb/15 ]

Is there any specific reason for this decision? Spent some time debugging because of this and I must say that such oddities are rather frustrating.

Comment by Marco Pivetta [ 10/Feb/15 ]

Dmitriy Shashkin we currently don't have an operation opposite to orphanRemoval





[DDC-3480] ORM\Embeddable does not create ManyToOne column in the database Created: 09/Jan/15  Updated: 09/Feb/15

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

Type: Bug Priority: Major
Reporter: Tomas Voslar Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 1
Labels: None

Issue Links:
Reference
relates to DDC-3556 [GH-1297] [DDC-3480] Docs: Embeddable... Resolved

 Description   

Following Embeddable

/**
 * @ORM\Embeddable
 */
class Address
{
    /**
     * @ORM\ManyToOne(targetEntity="Country")
     */
    protected $country;

won't save country attribute into the database table, other simple attributes (like type="text") saved normally.

    /**
     * @ORM\Embedded(class="LuciniLucini\Adsender\CommonBundle\Entity\Address")
     */
    private $address;


 Comments   
Comment by Marco Pivetta [ 09/Jan/15 ]

The issue seems incomplete to me: what exactly is the failure? Can you make an example?

Comment by Tomas Voslar [ 09/Jan/15 ]

Okay, I am sorry. I have main entity which includes Embeddable entity (Address), this address entity contains country attribute with ManyToOne relation, but this country is not being saved into the database table, other attributes like street (string) are being saved normally.

Comment by Tomas Voslar [ 09/Jan/15 ]

Basically it creates main entity with all fields from embeddable except country which is ManyToOne.

Comment by Marco Pivetta [ 09/Jan/15 ]

Ah, now I get it (I was probably misreading it). We don't support associations from embeddables right now: please check the test suite, but they really don't provide this functionality right now.

Comment by Tomas Voslar [ 09/Jan/15 ]

And is there any chance it will be supported in the near future? Or it's not possible?

Comment by Marco Pivetta [ 09/Jan/15 ]

It will probably not implemented for now, as embeddables (in our vision) are fitting the use-case of ValueObjects. ValueObjects are (usually) supposed to be containing serializable data, and an entity reference is not serializable data.

Comment by Tomas Voslar [ 09/Jan/15 ]

Okay, understood. So it's not good idea to use embeddables for Address entity for example, with this country as relation to another table, right? It seemed to me like best case. Thank you for the support anyway.

Comment by Marco Pivetta [ 09/Jan/15 ]

So it's not good idea to use embeddables for Address entity for example, with this country as relation to another table, right?

I'd rather just save the country identifier in the embeddable instead.

Comment by Tomas Voslar [ 09/Jan/15 ]

So you mean, instead of ManyToOne, save just id=integer (so no relation with entity)?

Comment by Marco Pivetta [ 09/Jan/15 ]

Correct: simple scalar or serializable types

Comment by Tomas Voslar [ 09/Jan/15 ]

https://github.com/doctrine/doctrine2/blob/400acad53355f24137e18d5cd55ccf6ff828cfbe/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php

Line 121 method testDqlOnEmbeddedObjectsField, guess I am wrong, but it seems there should be support for embeddable with relations though.

Comment by Yavin [ 11/Jan/15 ]

Hi,
if is is not supported i think an exception should be thrown when someone use association in embedded class. Now it is just silently ommited.

I found code where embedded metadata is added:
https://github.com/doctrine/doctrine2/blob/573153669c11a6f69201513831d3b8ce5e111d25/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php#L3200

Comment by Eugene Dounar [ 02/Feb/15 ]

It will probably not implemented for now, as embeddables (in our vision) are fitting the use-case of ValueObjects. ValueObjects are (usually) supposed to be containing serializable data, and an entity reference is not serializable data.

This should be explicitly stated in the documentation.

Comment by Marco Pivetta [ 02/Feb/15 ]

Eugene Dounar please send a PR to the documentation with the wording you prefer.

Comment by Eugene Dounar [ 09/Feb/15 ]

Marco Pivetta http://www.doctrine-project.org/jira/browse/DDC-3556





[DDC-3218] Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::__construct() must be of the type array, null given Created: 18/Jul/14  Updated: 09/Feb/15  Resolved: 09/Feb/15

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

Type: Bug Priority: Major
Reporter: Grégoire Pineau Assignee: Marco Pivetta
Resolution: Incomplete Votes: 1
Labels: None
Environment:

Linux / Mint 15
php 5.5.*



 Description   

Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::__construct() must be of the type array, null given, called in /home/greg/dev/product/insight/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 1009 and defined

Stack trace:

[1] PHPUnit_Framework_Error: Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::__construct() must be of the type array, null given, called in /project/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 1009 and defined
at n/a
in /project/vendor/doctrine/orm/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php line 47

at PHPUnit_Util_ErrorHandler::handleError('4096', 'Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::__construct() must be of the type array, null given, called in /project/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 1009 and defined', '/project/vendor/doctrine/orm/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php', '47', array('entity' => object(Violation), 'em' => object(EntityManager)))
in /project/vendor/doctrine/orm/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php line 47

at Doctrine\ORM\Event\PreUpdateEventArgs->__construct(object(Violation), object(EntityManager), null)
in /project/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php line 1009

at Doctrine\ORM\UnitOfWork->executeUpdates(object(ClassMetadata))
in /project/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php line 341

at Doctrine\ORM\UnitOfWork->commit(null)
in /project/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php line 389

at Doctrine\ORM\EntityManager->flush()
in /project/src/SensioLabs/Bundle/MyBundle/Controller/MyController.php line 127

at SensioLabs\Bundle\MyBundle\Controller\MyController->ignoreAction(object(Request), object(Project), object(Analysis), '4')
in line

at call_user_func_array(array(object(MyController), 'ignoreAction'), array(object(Request), object(Project), object(Analysis), '4'))
in /project/app/bootstrap.php.cache line 1043

at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in /project/app/bootstrap.php.cache line 1015

at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in /project/app/bootstrap.php.cache line 1154

at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
in /project/app/bootstrap.php.cache line 435

at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in /project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Client.php line 81

at Symfony\Component\HttpKernel\Client->doRequest(object(Request))
in /project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php line 111

at Symfony\Bundle\FrameworkBundle\Client->doRequest(object(Request))
in /project/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Client.php line 319

at Symfony\Component\BrowserKit\Client->request('POST', '/projects/id-foo/analyses/2/rule/4/ignore', array('ignore_rule' => array('comment' => 'Message about why this rule has been ignored', '_token' => 'CxEFTSv4GZQSWYXtRt-eHybaML4z8I0WK1DHiwr8Ih0')))
in /project/src/SensioLabs/Bundle/MyBundle/Test/Client.php line 489

at SensioLabs\Bundle\MyBundle\Test\Client->ignoreRuleViolations('id-foo', '2', '4', false)
in /project/src/SensioLabs/Bundle/MyBundle/Tests/Acceptance/ViolationCommentsTest.php line 217

at SensioLabs\Bundle\MyBundle\Tests\Acceptance\ViolationCommentsTest->testDashboardWithCriticalIgnoredRules()
in line

at ReflectionMethod->invokeArgs(object(ViolationCommentsTest), array())
in /project/vendor/phpunit/phpunit/src/Framework/TestCase.php line 951

at PHPUnit_Framework_TestCase->runTest()
in /project/vendor/phpunit/phpunit/src/Framework/TestCase.php line 817

at PHPUnit_Framework_TestCase->runBare()
in /project/vendor/phpunit/phpunit/src/Framework/TestResult.php line 686

at PHPUnit_Framework_TestResult->run(object(ViolationCommentsTest))
in /project/vendor/phpunit/phpunit/src/Framework/TestCase.php line 753

at PHPUnit_Framework_TestCase->run(object(PHPUnit_Framework_TestResult))
in /project/vendor/phpunit/phpunit/src/Framework/TestSuite.php line 675

at PHPUnit_Framework_TestSuite->run(object(PHPUnit_Framework_TestResult))
in /project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php line 426

at PHPUnit_TextUI_TestRunner->doRun(object(PHPUnit_Framework_TestSuite), array('listGroups' => false, 'loader' => null, 'useDefaultConfiguration' => true, 'configuration' => '/project/app/phpunit.xml.dist', 'filter' => 'testDashboardWithCriticalIgnoredRules', 'testSuffixes' => array('Test.php', '.phpt')))
in /opt/dotfiles/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php line 176

at PHPUnit_TextUI_Command->run(array('/usr/local/bin/phpunit', 'c', 'app/', '-filter', 'testDashboardWithCriticalIgnoredRules', 'src/SensioLabs/Bundle/MyBundle/Tests/Acceptance/ViolationCommentsTest.php'), true)
in /opt/dotfiles/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php line 129

at PHPUnit_TextUI_Command::main()
in /opt/dotfiles/vendor/phpunit/phpunit/composer/bin/phpunit line 63

I fails in this code

    private function executeUpdates($class)
    {
        $className          = $class->name;
        $persister          = $this->getEntityPersister($className);
        $preUpdateInvoke    = $this->listenersInvoker->getSubscribedSystems($class, Events::preUpdate);
        $postUpdateInvoke   = $this->listenersInvoker->getSubscribedSystems($class, Events::postUpdate);

        foreach ($this->entityUpdates as $oid => $entity) {
            if ($this->em->getClassMetadata(get_class($entity))->name !== $className) {
                continue;
            }

            if ($preUpdateInvoke != ListenersInvoker::INVOKE_NONE) {
// => this line
                $this->listenersInvoker->invoke($class, Events::preUpdate, $entity, new PreUpdateEventArgs($entity, $this->em, $this->entityChangeSets[$oid]), $preUpdateInvoke);
                $this->recomputeSingleEntityChangeSet($class, $entity);
            }

            if ( ! empty($this->entityChangeSets[$oid])) {
                $persister->update($entity);
            }

            unset($this->entityUpdates[$oid]);

            if ($postUpdateInvoke != ListenersInvoker::INVOKE_NONE) {
                $this->listenersInvoker->invoke($class, Events::postUpdate, $entity, new LifecycleEventArgs($entity, $this->em), $postUpdateInvoke);
            }
        }
    }


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

Requires a test case

Comment by Victor [ 26/Aug/14 ]

I have same bug when call flush() method from entity manager in my few event listeners in Symfony.

P.S. If I call flush() only from one listener - it works well, but when call flush() in first, and then in second - it fails. And it does not matter in which order listeners are called.

Comment by Grégoire Pineau [ 26/Aug/14 ]

yeah, the bug occurs in the same circumstance as described by victor.
(sorry for the delay, and sorry to not provider a test case)

Comment by Christophe Coevoet [ 26/Aug/14 ]

Calling flush() inside a Doctrine listener is not a supported Doctrine usage. it means you are trying to nest several flushes inside each other, which can indeed break the unit of work

Comment by Grégoire Pineau [ 26/Aug/14 ]

I refactored this part of our code base, to remove all flush from the listener. Everything works right now.
But I did not know this was not possible. (And it's not me the guy who created this **** in our codebase )

Comment by Victor [ 26/Aug/14 ]

So, for example, if I use postUpdate Doctrine event to modify the entity after save them to DB, I can't save additional changes to DB again with flush() in my listener?
Is it will be fixed or it's a normal behavior of Doctrine?

Comment by Timur Ramazanov [ 09/Feb/15 ]

I ran into the same issue, I wonder, what should I do?

if I use postUpdate Doctrine event to modify the entity after save them to DB, I can't save additional changes to DB again with flush() in my listener?

Is there an answer on this?

Comment by Marco Pivetta [ 09/Feb/15 ]

Flushing in a listener that acts during EntityManagerInterface#flush() is disallowed.

Comment by Marco Pivetta [ 09/Feb/15 ]

I'm marking this issue as incomplete: not reproducible without a test case.





[DDC-3563] Wrong metadata output. One-To-Many, Bidirectional Created: 08/Feb/15  Updated: 08/Feb/15

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

Type: Bug Priority: Major
Reporter: Jason Schilling Assignee: Steve Müller
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Zip Archive Data.zip    

 Description   

During observe the metadata in a One-To-Many association I've noticed that, the inversedBy value is NULL but in the annotation its assigned to something like $images (look example). I think its wrong because the EntityGenerator dont get it and dont generate the add..., remove... and get...s Method stubs or the __constructor assignment to ArrayCollections.






[DDC-3562]  Make two different join request with different join condition with Doctrine ORM Created: 06/Feb/15  Updated: 06/Feb/15

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

Type: Bug Priority: Major
Reporter: Colin Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Doctrine2 symfony integration
PHP 5.5.2
MySQL 5.5.41
Linux
doctrine/annotations v1.2.3
doctrine/cache v1.4.0
doctrine/collections v1.2
doctrine/common v2.4.2
doctrine/dbal v2.5.1
doctrine/doctrine-bundle v1.3.0
doctrine/doctrine-cache-bundle v1.0.1
doctrine/inflector v1.0.1
doctrine/lexer v1.0.1
doctrine/orm v2.4.7



 Description   

I want to make two requests on an object and join a one to many relation using doctrine ORM. The first request has different condition on the joined object.
The first request should join one object, and the second one two, but both return one object when run with the same EntityManager context.

The test entity

    /**
     * TreeNode
     *
     * @ORM\Table(name="treeNode")
     */
    class TreeNode {
    	/**
    	* @var integer
    	*
    	* @ORM\Id
    	* @ORM\Column(name="id", type="integer")
    	* @ORM\GeneratedValue(strategy="AUTO")
    	*/
    	private $id;
    
    	/**
    	* @var string
    	*
    	* @ORM\Column(name="name", type="string", length=50)
    	*/
    	private $name;
    
    	/**
    	* @var \Doctrine\Common\Collections\Collection
    	*
    	* @ORM\JoinColumn(name="subdirs", nullable=true)
    	* @ORM\OneToMany(targetEntity="TestBundle\Entity\TreeNode", mappedBy="parent", cascade={"persist"})
    	*/
    	private $subdirs;
    
    	/**
    	* @var TestBundle\Entity\TreeNode
    	*
    	* @ORM\JoinColumn(name="parent", nullable=true)
    	* @ORM\ManyToOne(targetEntity="TestBundle\Entity\TreeNode", inversedBy="subdirs")
    	*/
    	private $parent;
    }

Adding some test data

    $parent = new TreeNode();
    $parent->setName('Parent');
    $parent->setParent(null);
    
    $child1 = new TreeNode();
    $child1->setName('Child1');
    $child1->setParent($parent);
    
    $child2 = new TreeNode();
    $child2->setName('Child2');
    $child2->setParent($parent);

Run the queries

    $repo = $em->getRepository('TestBundle:TreeNode');

    $qb = $repo->createQueryBuilder('t');
    $qb->innerJoin('t.subdirs', 'subnode')
    		->addSelect('subnode')
    		->where('t.name = :parentName')
    		->setParameter('childName', 'Child1')
    		->andWhere('subnode.name = :childName')
    		->setParameter('parentName', 'Parent');
    
    $result = $qb->getQuery()->getOneOrNullResult();
    var_dump($result->getSubdirs()->count()); // Gives 1, ok 
    
    
    // Get parent parent + all childs
    $qb = $repo->createQueryBuilder('t');
    $qb->innerJoin('t.subdirs', 'subnode')
    		->addSelect('subnode')
    		->where('t.name = :parentName')
    		->setParameter('parentName', 'Parent');
    $result = $qb->getQuery()->getOneOrNullResult();
    var_dump($result->getSubdirs()->count()); // Gives 1, should have been 2 !
  • The second request only returns one "subdir" object, while it should have been two.
  • If I run the second request without the first one, I get the two results, as expected. Inverting the request makes the second one return two results instead of one.
  • The correct SQL requests are run by this code, only the returned result is wrong.
  • Running `$em->clear()` between the two statements works, but I don't want to untrack my other entities.





[DDC-3558] Sequence name generation for identity strategy Created: 04/Feb/15  Updated: 05/Feb/15

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

Type: Bug Priority: Major
Reporter: Gemorroj Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: generator-strategy, identity, metadata, sequence

Attachments: PNG File Захват-1.png    

 Description   

In version 2.5 added support sequence with the strategy of identity.
But I cannot get the correct name of the sequence with the strategy of identity. With the strategy sequence produces the correct name. It is taken from the configuration sequenceName. Strategy identity name sequence will not be taken from the configuration, and is always generated is automatically (which is not working properly in my case).

see: https://github.com/doctrine/doctrine2/blob/4c68a38bd6b7d590dbfa90b2bb116129381935ce/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php#L632
the title sequence is generated automatically.

https://github.com/doctrine/doctrine2/blob/4c68a38bd6b7d590dbfa90b2bb116129381935ce/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php#L662
and in this case, it first checks its own configuration.



 Comments   
Comment by Gemorroj [ 05/Feb/15 ]

Any comments plz..?

Comment by Marco Pivetta [ 05/Feb/15 ]

Gemorroj consider writing a test case with your problem/example: I can't understand the issue as it is currently written down.

A code example is also fine.

Comment by Gemorroj [ 05/Feb/15 ]

If you use the strategy SEQUENCE, the doctrine calls the sequence specified in the configuration. And inserts a record in the database with the specified ID.
If you are using the IDENTITY strategy, doctrine inserts a record without an ID. And after a record is inserted, causes sequence (https://github.com/doctrine/dbal/blob/8cbfefe03ff2d1a2246dfb6e98b84e4b36622e6f/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php#L148) to learn the value of id.
But, with the IDENTITY strategy, doctrine does not know how actually called a sequence.

Comment by Marco Pivetta [ 05/Feb/15 ]

Yes, when using the IDENTITY strategy, the sequence name is not used: https://github.com/doctrine/doctrine2/blob/4c68a38bd6b7d590dbfa90b2bb116129381935ce/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php#L626-L657

That's expected behavior: what are you expecting?

Comment by Gemorroj [ 05/Feb/15 ]

If doctrine determines that the database uses the sequence, then I expect the setup sequence doctrine is taken from the configuration.
https://github.com/doctrine/doctrine2/blob/4c68a38bd6b7d590dbfa90b2bb116129381935ce/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php#L636-L638
The generated name sequence wrong for me.

Comment by Marco Pivetta [ 05/Feb/15 ]

You should rather just use the SEQUENCE strategy.

Otherwise, provide a functional test case and eventually propose a fix.





[DDC-3343] `PersistentCollection::removeElement` schedules an entity for deletion when relationship is EXTRA_LAZY, with `orphanRemoval` false. Created: 09/Oct/14  Updated: 05/Feb/15  Resolved: 25/Jan/15

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

Type: Bug Priority: Blocker
Reporter: Andrea Sprega Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: mapping, orm

Issue Links:
Dependency
depends on DDC-3536 [GH-1281] Hotfix/#1169 extra lazy one... Resolved
depends on DDC-3544 [GH-1288] Hotfix - #1169 - extra lazy... Resolved
depends on DDC-3560 [GH-1300] [2.4] #1169 DDC-3343 one-to... Resolved
depends on DDC-3537 [GH-1282] Hotfix/#1169 extra lazy one... Resolved

 Description   

Given the following entity for which I only report the relevant association:

class Group
{
    /**
     * @ORM\OneToMany(targetEntity="User", mappedBy="group", fetch="EXTRA_LAZY")
     */
    protected $users;
    //...
}

and its inverse

class User
{
    /**
     * @ORM\ManyToOne(targetEntity="Group", inversedBy="users")
     * @ORM\JoinColumn(name="group_id", onDelete="SET NULL")
     */
    protected $group;
    //...
}

I experience a weird issue when, inside Group, I call $this->users->removeElement($user): Doctrine schedules the $user entity for deletion, no matter what (it doesn't check for the orphanRemoval attribute). Also, even re-adding the entity to a new Group before the flush() occurs doesn't prevent it from being deleted.

I believe this is a bug, since I do not see any special mention of this behavior in the documentation for extra lazy associations:
http://doctrine-orm.readthedocs.org/en/latest/tutorials/extra-lazy-associations.html.

The workaround for me has been to remove fetch="EXTRA_LAZY" from the relationship.

After digging a little bit into the source code, this seems to be the commit (and the line) that introduced this behavior:

https://github.com/doctrine/doctrine2/commit/356f5874bf81ca4e37681c233e24cc84d16e7a39#diff-108586f774fc8acb02163ed709e05e86R403

I also found this on Google:

https://groups.google.com/forum/#!topic/doctrine-user/cx_yBuoqiAE

which basically didn't help much, except for suggesting that it should be a feature when there is an orphanRemoval and/or a cascade operation in place (and that makes perfectly sense).

I set this to "critical" since (as it occurred to me) it can lead to irrecoverable data loss.

Is this effectively a bug?



 Comments   
Comment by Marco Pivetta [ 25/Jan/15 ]

Fixed via DDC-3536 and DDC-3537





[DDC-3551] [GH-1294] Avoid Connection error when calling ClassMetadataFactor::getAllMetadata() Created: 29/Jan/15  Updated: 04/Feb/15  Resolved: 04/Feb/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers, Tools
Affects Version/s: Git Master, 2.4.7
Fix Version/s: 2.5, 2.4.8
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: disconnected-metadata, entityGenerator, generation, lazy-loading, mapping, platform


 Description   

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

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

Message:

Hi guys!

When you pair the ORM with DBAL 2.5.0, then getting the `targetPlatform` means that a connection will be made to the database. For that reason, it's really important to not get the `targetPlatform` unless it's absolutely needed. Currently, if you call `ClassMetadataFactor::getAllMetadata()`, it will try to determine `targetPlatform` (in `initialize()`), which will make a connection. And if that connection fails (e.g. no db yet), it will blow up - even though `getAllMetadata()` doesn't need the `targetPlatform`.

This fixes that, and in an absolutely BC way, since `targetPlatform` is private (yay!). This should fix a number of issues in userland, like symfony/symfony-standard#748 and symfony/symfony-standard#774.

This is a PR to master (per the guidelines), but the real target is 2.4, since it's the latest stable. The patch won't apply cleanly, but it's simple: remove from initialize, then replace all references to the new private method.

Thanks in advance! More details are on the commit message.



 Comments   
Comment by Doctrine Bot [ 04/Feb/15 ]

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

Comment by Doctrine Bot [ 04/Feb/15 ]

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





[DDC-3559] [GH-1299] Fixed missing quote in one DQL example Created: 04/Feb/15  Updated: 04/Feb/15  Resolved: 04/Feb/15

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

Type: Documentation Priority: Trivial
Reporter: Doctrine Bot Assignee: Steve Müller
Resolution: Fixed Votes: 0
Labels: None


 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 04/Feb/15 ]

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

Comment by Doctrine Bot [ 04/Feb/15 ]

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





[DDC-3555] [GH-1296] Flip key value in $namespaces array Created: 03/Feb/15  Updated: 03/Feb/15  Resolved: 03/Feb/15

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

Type: Documentation Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, mapping, path, xml


 Description   

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

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

Message:

Key value should be other way around.



 Comments   
Comment by Doctrine Bot [ 03/Feb/15 ]

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

Comment by Doctrine Bot [ 03/Feb/15 ]

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





[DDC-3553] Create a QueryBuilder from a Query/DQL Created: 01/Feb/15  Updated: 01/Feb/15  Resolved: 01/Feb/15

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

Type: Documentation Priority: Major
Reporter: Dries De Peuter Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: querybuilder


 Description   

Hi,

I am searching for a way to create a QueryBuilder from an existing Query or a DQL string.

Can I currently do this?

If this is not the case. I would love to create this but I don't see how to parse the DQL into parts.



 Comments   
Comment by Marco Pivetta [ 01/Feb/15 ]

.

Not an issue

Note that the QueryBuilder just assembles strings: there is currently no way to transform DQL into a query builder, as the operation is not bijective.

Comment by Dries De Peuter [ 01/Feb/15 ]

I understand. Is their any way you would suggest allowing a DQL to be altered/extended.





[DDC-3319] Get the converted value in convertToDatabaseValueSQL() Created: 23/Sep/14  Updated: 01/Feb/15

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

Type: Bug Priority: Minor
Reporter: Benjamin Morel Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 1
Labels: mapping


 Description   

I have a use case where it would be useful to get the value being converted in the convertToDatabaseValueSQL() method, not just in convertToDatabaseValue().

Take the following mapping for a Geometry type:

    public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        return $value->asBinary();
    }

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

In GIS-enabled databases, ST_GeomFromWkb() takes two parameters: the WKB binary representation of the geometry, and an integer representing the SRID (coordinate system) of the geometry, in this example the hardcoded value 4326.

I would be nice to have access to the value being converted in the convertToDatabaseValueSQL() as well, to be able to get the SRID from the geometry object itself, and replace the above code with something like:

    public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform, $value)
    {
        return sprintf('ST_GeomFromWkb(%s, %s)', $sqlExpr, $value->srid());
    }

I don't think there is currently a technical way to do this (please correct me if I'm wrong).

Could we find a BC way to pass the value being converted to the convertToDatabaseValueSQL() method to add support for this use case?



 Comments   
Comment by Michael Lucas [ 25/Jan/15 ]

The use case which you described above would be a great addition to the convertToDatabaseValueSQL() or in the convertToDatabaseValue() be able to return an array of values which could be used in the convertToDatabaseValueSQL().

    public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        return array('geometry' => $value->asBinary(), 'srid'=>$value->getSRID());
    }

    public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
    {
        return sprintf('ST_GeomFromWkb(%s, %s)', ':geometry', ':srid');
    }
Comment by Benjamin Morel [ 25/Jan/15 ]

Michael Lucas It's an interesting idea, it would work as well, although I think it might be much more complicated to implement!

Comment by Paolo Agostinetto [ 01/Feb/15 ]

It there a workaround for this? I'm probably going to use a native query.

My use case is pretty common among Postgres full-text users: I need to insert a record
using the ts_vector() function with both parameters, eg: ts_vector('english', 'This is a test'),
and both parameters has to be passed on record creation.





[DDC-3552] Code generation throws exceptions when embeddables are used Created: 30/Jan/15  Updated: 30/Jan/15

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

Type: Bug Priority: Major
Reporter: Vladislav Veselinov Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I've created a gist showing the code you can use to reproduce the issue
https://gist.github.com/v3labs/d02244c99a87444be709

I've also included the composer.json file.

When I run php app/console doctrine:generate:entities AppBundle -v, I get the following exception:

[Symfony\Component\Debug\Exception\ContextErrorException]
Notice: Trying to get property of non-object

Exception trace:
() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php:3251
Symfony\Component\Debug\ErrorHandler->handleError() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php:3251
Doctrine\ORM\Mapping\ClassMetadataInfo->inlineEmbeddable() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:201
Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:332
Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:225
Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:115
Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/doctrine-bundle/Mapping/DisconnectedMetadataFactory.php:201
Doctrine\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory->getAllMetadata() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/doctrine-bundle/Mapping/DisconnectedMetadataFactory.php:164
Doctrine\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory->getMetadataForNamespace() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/doctrine-bundle/Mapping/DisconnectedMetadataFactory.php:54
Doctrine\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory->getBundleMetadata() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/doctrine-bundle/Command/GenerateEntitiesDoctrineCommand.php:96
Doctrine\Bundle\DoctrineBundle\Command\GenerateEntitiesDoctrineCommand->execute() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:253
Symfony\Component\Console\Command\Command->run() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:882
Symfony\Component\Console\Application->doRunCommand() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:96
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at /Users/vladislav/Sites/doctrine2.5_tests/app/console:27

If I add columnPreffix to the @Embed annotation the exception is different:

[Symfony\Component\Debug\Exception\ContextErrorException]
Catchable Fatal Error: Argument 1 passed to Doctrine\ORM\Mapping\ReflectionEmbeddedProperty::__construct() must be an instance of ReflectionP
roperty, null given, called in /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php on
line 952 and defined

Exception trace:
() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php:61
Symfony\Component\Debug\ErrorHandler->handleError() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php:61
Doctrine\ORM\Mapping\ReflectionEmbeddedProperty->__construct() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php:952
Doctrine\ORM\Mapping\ClassMetadataInfo->wakeupReflection() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:721
Doctrine\ORM\Mapping\ClassMetadataFactory->wakeupReflection() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:343
Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:225
Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:115
Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/doctrine-bundle/Mapping/DisconnectedMetadataFactory.php:201
Doctrine\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory->getAllMetadata() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/doctrine-bundle/Mapping/DisconnectedMetadataFactory.php:164
Doctrine\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory->getMetadataForNamespace() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/doctrine-bundle/Mapping/DisconnectedMetadataFactory.php:54
Doctrine\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory->getBundleMetadata() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/doctrine/doctrine-bundle/Command/GenerateEntitiesDoctrineCommand.php:96
Doctrine\Bundle\DoctrineBundle\Command\GenerateEntitiesDoctrineCommand->execute() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:253
Symfony\Component\Console\Command\Command->run() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:882
Symfony\Component\Console\Application->doRunCommand() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:96
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Users/vladislav/Sites/doctrine2.5_tests/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at /Users/vladislav/Sites/doctrine2.5_tests/app/console:27

doctrine:generate:entities [--path="..."] [--no-backup] name

I don't think it's a Symfony specific issue. I tried using the built-in CLI tool and got the same results.



 Comments   
Comment by Marco Pivetta [ 30/Jan/15 ]

Yeah, this can't really work with code-gen, because embeddables require reflection to be initialized in order to operate, whereas the codegen cli-tools operate with a DisconnectedMetadataFactory, which skips reflection on purpose (it assumes that the class does not exist, therefore it does not start up reflection).

I think it's a can't fix for now.

Comment by Vladislav Veselinov [ 30/Jan/15 ]

Sorry for the formatting. I had never used jira before.

Comment by Marco Pivetta [ 30/Jan/15 ]

Vladislav Veselinov fixed the formatting, no big deal

Comment by Vladislav Veselinov [ 30/Jan/15 ]

Btw:

Changing line 947 in ClassMetadataInfo to:

if (isset($mapping['declaredField']) && $parentReflFields[$mapping['declaredField']]) {

seems to bypass the problem and the generation runs fine, but I don't know if it breaks something else. Doesn't seem like it but ... I'm not sure

Comment by Vladislav Veselinov [ 30/Jan/15 ]

Just figured out with it won't work in all cases. I'll keep digging. Thanks for the feedback!





[DDC-3549] [GH-1292] Mark getSelectConditionStatementColumnSQL method as private Created: 28/Jan/15  Updated: 29/Jan/15  Resolved: 29/Jan/15

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

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: bc, persister


 Description   

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

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

Message:

The `Doctrine/\ORM\Persisters\BasicEntityPersister::getSelectConditionStatementColumnSQL` method has been marked as `private`.

The current `protected` mark is a bit unuseful since everything is already handled into the public method `getSelectConditionStatementSQL`.



 Comments   
Comment by Doctrine Bot [ 29/Jan/15 ]

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





[DDC-3321] [GH-1145] Minor performance tweaks Created: 23/Sep/14  Updated: 28/Jan/15  Resolved: 23/Sep/14

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

Type: Improvement Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Invalid 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/1145

Message:

Function calls are expensive in PHP, this PR just removes unnecessary calls to `call_user_func()` when a direct `$variable()` call is possible.



 Comments   
Comment by Doctrine Bot [ 23/Sep/14 ]

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

Comment by Doctrine Bot [ 23/Sep/14 ]

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

Comment by Doctrine Bot [ 28/Jan/15 ]

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





[DDC-3548] [GH-1291] Conversion to PHP 5.4's short array syntax Created: 28/Jan/15  Updated: 28/Jan/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved 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/1291

Message:

Now that the minimum PHP version is 5.4, it would be good to encourage the use of the short array syntax `[]`.
Converting the existing codebase to this syntax will promote this good practice and encourage everyone to follow it.

I have converted the codebase with [a tool](https://gist.github.com/BenMorel/6994483) I wrote for personal projects:

find doctrine2 -type f -name '*.php' -exec php short-array-syntax-converter.php {} \;

The number of changes is quite large, but I'm confident that nothing is broken, and the passing tests confirm this.



 Comments   
Comment by Doctrine Bot [ 28/Jan/15 ]

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

Comment by Doctrine Bot [ 28/Jan/15 ]

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





[DDC-3452] [GH-1222] Embeddables in metadata builder Created: 17/Dec/14  Updated: 28/Jan/15

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

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


 Description   

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

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

Message:

Embeddables set the `$classMetadata->isEmbeddedClass = true` and sets `$classMetadata->isMappedSuperclass = false`, imitating the `switch` in xml / yml drivers.

Embeddeds have 2 methods, as other types have: `addEmbedded` is a one-off adder with fluent behavior, and `createEmbedded` returns an instance of `EmbeddedBuilder`. The class is very thin right now, but it's a good way to lay ground for improvements on embedded creation in the future.

This one is probably more useful than the last one, @Ocramius



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 26/Jan/15 ]

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

Comment by Doctrine Bot [ 28/Jan/15 ]

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

Comment by Doctrine Bot [ 28/Jan/15 ]

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





[DDC-3517] [GH-1265] Fix error undefined index "targetEntity" in persister Created: 18/Jan/15  Updated: 28/Jan/15  Resolved: 18/Jan/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: inheritance, one-to, onetoone, persister, sti


 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 18/Jan/15 ]

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

Comment by Doctrine Bot [ 18/Jan/15 ]

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





[DDC-3544] [GH-1288] Hotfix - #1169 - extra lazy one to many must be no-op when not doing orphan removal Created: 27/Jan/15  Updated: 28/Jan/15  Resolved: 28/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, ORM
Affects Version/s: 2.5
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Blocker
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: collection, extra-lazy, lazy-loading, onetomany, orphanRemoval

Issue Links:
Dependency
is required for DDC-3343 `PersistentCollection::removeElement`... Resolved
is required for DDC-3536 [GH-1281] Hotfix/#1169 extra lazy one... Resolved

 Description   

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

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

Message:

See https://github.com/doctrine/doctrine2/pull/1281#issuecomment-71403668



 Comments   
Comment by Doctrine Bot [ 28/Jan/15 ]

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

Comment by Doctrine Bot [ 28/Jan/15 ]

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

Comment by Doctrine Bot [ 28/Jan/15 ]

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





[DDC-3346] findOneBy returns an object with partial collection for the properties with mapping oneToMany/Fetch Eager Created: 10/Oct/14  Updated: 28/Jan/15  Resolved: 25/Jan/15

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

Type: Bug Priority: Critical
Reporter: Adrien Russo Assignee: Marco Pivetta
Resolution: Fixed Votes: 2
Labels: collection, eager, fetch, lazy-loading, many-to-many, onetomany, persister

Issue Links:
Dependency
depends on DDC-3534 [GH-1280] [DDC-3346] #1277 find one w... Open
depends on DDC-3531 [GH-1277] [DDC-3346] Failing test for... Resolved

 Description   

findOneBy returns an object with partial collection for the properties with mapping oneToMany/Fetch Eager. This bug appear only for entities without inheritance.

Mapping
       
Test\Bar:
    type: entity
    table: bar
    fields:
        code:
            type: string
    oneToMany:
        posts:
            targetEntity: Test\Post
            fetch: EAGER
            mappedBy: bar
            cascade: ['all']
    
Test\Post:
    type: entity
    table: post
    fields:
        content:
            type: text
    manyToOne:
        bar:
            targetEntity: Test\Bar
            cascade: []
            joinColumn:
                name: bar_id
                referencedColumnName: id
Data
    
$bar = new \Test\Bar('foo');
$bar->addPost(
  new Test\Post('toto')
);
$bar->addPost(
  new Test\Post('tata')
);
 
$bar->getPosts()->count(); #value is 2
$manager->persist($bar);
$manager->flush();
FindOneBy with fetch eager
$bar = $repository->findOneBy(['code' => 'foo']);
$bar->getPosts()->count(); #value is 1
FindOneBy with fetch Lazy
$bar = $repository->findOneBy(['code' => 'foo']);
$bar->getPosts()->count(); #value is 2

I think this bug is due to the LIMIT 1 clause happening on findOneBy which also applies on joins generated here.

For instance, the generated SQL statement generated might look like

Sql Statement
SELECT
	t0. ID AS id_1,
	t0.code AS code_2,
	t1. ID AS id_3,
	t1.content AS content_4,
	t1.bar_id AS bar_id_5
FROM
	bar t0
LEFT JOIN post t1 ON t1.bar_id = t0. ID
WHERE
	t0. code = 'foo'
LIMIT 1


 Comments   
Comment by Pavel Batanov [ 22/Jan/15 ]

Still expiriencing it at 2.5.0-alpha (b889e18a9a15c36eac7349b06cb4b0f955a9da57). findOneBy cuts many-to-many association with fetch eager by 'LIMIT 1'

Comment by Marco Pivetta [ 22/Jan/15 ]

Pavel Batanov yeah, we don't have a fix for it yet: I suggest providing a PR with the failing test first, and if we can't get to it, trying to patch it yourself, or at least find out which code bit affects this behavior.

Comment by Pavel Batanov [ 22/Jan/15 ]

I'm finishing such PR now. Will supply it to github soon

Comment by Pavel Batanov [ 22/Jan/15 ]

here it is
https://github.com/doctrine/doctrine2/pull/1277
http://www.doctrine-project.org/jira/browse/DDC-3531

Here is the failed travis build
https://travis-ci.org/scaytrase/doctrine2/jobs/47921568

Comment by Doctrine Bot [ 23/Jan/15 ]

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

Comment by Doctrine Bot [ 23/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 25/Jan/15 ]

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

Comment by Marco Pivetta [ 25/Jan/15 ]

Handled in DDC-3534

Comment by Matteo Beccati [ 28/Jan/15 ]

FYI the test is failing on: https://revive.beccati.com/bamboo/browse/PHP-DOCTR-PHP54-249/test/case/18357533

As far as I can tell from https://www.sqlite.org/lang_select.html SQLite doesn't support OFFSET w/o LIMIT.

Doctrine\Tests\ORM\Functional\Ticket\DDC3346Test::testFindWithEagerFetchAndOffsetWillNotHydrateLimitedCollection
Exception: [Doctrine\DBAL\Exception\SyntaxErrorException] An exception occurred while executing 'SELECT t0.id AS id_1, t0.username AS username_2 FROM ddc3346_users t0 WHERE t0.username = ? OFFSET 0' with params ["bwoogy"]:

SQLSTATE[HY000]: General error: 1 near "OFFSET": syntax error

With queries:
6. SQL: '"COMMIT"' Params: 
5. SQL: 'INSERT INTO ddc3346_articles (user_id) VALUES (?)' Params: '1'
4. SQL: 'INSERT INTO ddc3346_articles (user_id) VALUES (?)' Params: '1'
3. SQL: 'INSERT INTO ddc3346_users (username) VALUES (?)' Params: 'bwoogy'
2. SQL: '"START TRANSACTION"' Params: 

Trace:
/home/atlassian/bamboo/xml-data/build-dir/PHP-DOCTR-PHP54/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:116
/home/atlassian/bamboo/xml-data/build-dir/PHP-DOCTR-PHP54/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:838
/home/atlassian/bamboo/xml-data/build-dir/PHP-DOCTR-PHP54/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:875
/home/atlassian/bamboo/xml-data/build-dir/PHP-DOCTR-PHP54/lib/Doctrine/ORM/EntityRepository.php:181
/home/atlassian/bamboo/xml-data/build-dir/PHP-DOCTR-PHP54/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3346Test.php:53
/home/atlassian/bamboo/xml-data/build-dir/PHP-DOCTR-PHP54/vendor/phpunit/phpunit/src/Framework/TestCase.php:860
/home/atlassian/bamboo/xml-data/build-dir/PHP-DOCTR-PHP54/vendor/phpunit/phpunit/src/Framework/TestCase.php:737
/home/atlassian/bamboo/xml-data/build-dir/PHP-DOCTR-PHP54/vendor/phpunit/phpunit/src/Framework/TestResult.php:609
/home/atlassian/bamboo/xml-data/build-dir/PHP-DOCTR-PHP54/vendor/phpunit/phpunit/src/Framework/TestCase.php:693
/home/atlassian/bamboo/xml-data/build-dir/PHP-DOCTR-PHP54/vendor/phpunit/phpunit/src/Framework/TestSuite.php:716
/home/atlassian/bamboo/xml-data/build-dir/PHP-DOCTR-PHP54/vendor/phpunit/phpunit/src/Framework/TestSuite.php:716
/home/atlassian/bamboo/xml-data/build-dir/PHP-DOCTR-PHP54/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:398
phar:///home/atlassian/bin/phpunit.phar/phpunit/TextUI/Command.php:179
phar:///home/atlassian/bin/phpunit.phar/phpunit/TextUI/Command.php:132
/home/atlassian/bin/phpunit.phar:584
Comment by Steve Müller [ 28/Jan/15 ]

Matteo Beccati I believe this is fixed already by https://github.com/doctrine/dbal/pull/782

Comment by Matteo Beccati [ 28/Jan/15 ]

My mistake. The build wasn't cleaning up the vendor dir before running composer update, so it was still using an old dbal.





[DDC-2093] Doctrine Criteria does not support sorting by relationed field Created: 20/Oct/12  Updated: 28/Jan/15

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

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


 Description   
// Here I call Criteria filter
public function getWalletsActive() {
	$criteria = Criteria::create()
		->where(Criteria::expr()->eq("isRemoved", "0"))
		->orderBy(array("currency.id" => "ASC"));
	return $this->wallets->matching($criteria);
}

// Relation
/**
 * @var Currency
 *
 * @ORM\ManyToOne(targetEntity="Currency")
 * @ORM\JoinColumns({
 * @ORM\JoinColumn(name="id_currency", referencedColumnName="id")
 * })
 */
protected $currency;

// File BasicEntityPersister.php
// This cause the problem:
if ( ! isset($this->_class->fieldMappings[$fieldName])) {
    throw ORMException::unrecognizedField($fieldName);
}
// There are no relations in $this->_class->fieldMappings at all!


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

Mark as improvement.

Comment by Liverbool [ 28/Jan/15 ]

How about this?

Comment by Marco Pivetta [ 28/Jan/15 ]

Liverbool give it a try and open a PR





[DDC-3547] [GH-1290] [Doc] [Reference] [Second Level Cache] Created: 27/Jan/15  Updated: 27/Jan/15  Resolved: 27/Jan/15

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

Type: Documentation Priority: Trivial
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: typo


 Description   

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

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

Message:

Updated reference for Second Level Cache (fixed some typos and docblocks).



 Comments   
Comment by Doctrine Bot [ 27/Jan/15 ]

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

Comment by Doctrine Bot [ 27/Jan/15 ]

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





[DDC-3540] [GH-1285] travis: remove unnecessary database creation Created: 25/Jan/15  Updated: 27/Jan/15  Resolved: 27/Jan/15

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

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: ci, performance, setup, travis

Issue Links:
Duplicate
duplicates DDC-3546 [GH-1289] Improve test suite Resolved
Reference
relates to DDC-3532 [GH-1278] travis: remove unnecessary ... Resolved
is referenced by DDC-3546 [GH-1289] Improve test suite Resolved

 Description   

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

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

Message:

Ref: #1278



 Comments   
Comment by Doctrine Bot [ 25/Jan/15 ]

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

Comment by Doctrine Bot [ 25/Jan/15 ]

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

Comment by Doctrine Bot [ 27/Jan/15 ]

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





[DDC-3546] [GH-1289] Improve test suite Created: 27/Jan/15  Updated: 27/Jan/15  Resolved: 27/Jan/15

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

Type: Improvement Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: ci, performance, phpunit, testing, travis

Issue Links:
Duplicate
is duplicated by DDC-3540 [GH-1285] travis: remove unnecessary ... Resolved
Reference
relates to DDC-3540 [GH-1285] travis: remove unnecessary ... Resolved

 Description   

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

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

Message:

This PR adopts DBAL's latest test suite improvements from https://github.com/doctrine/dbal/pull/597/files, https://github.com/doctrine/dbal/pull/643/files, https://github.com/doctrine/dbal/pull/779 and https://github.com/doctrine/dbal/pull/758/files
Supersedes https://github.com/doctrine/doctrine2/pull/1285



 Comments   
Comment by Doctrine Bot [ 27/Jan/15 ]

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

Comment by Doctrine Bot [ 27/Jan/15 ]

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

Comment by Doctrine Bot [ 27/Jan/15 ]

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





[DDC-2693] Attribute/association overrides should be ignored when generating entities Created: 19/Sep/13  Updated: 27/Jan/15

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

Type: Bug Priority: Minor
Reporter: Joris van de Sande Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 9
Labels: command

Issue Links:
Duplicate
is duplicated by DDC-3109 [Doctrine\ORM\Mapping\MappingExceptio... Open

 Description   

The "orm:generate-entities" command fails when doctrine attribute and/or association overrides are used. So from the moment that you use an attribute/association override, it is implossible to use the generate entities command. I think that the solution to this problem is to ignore the overrides when generating entities.

The exception given in case of an attribute override is (this is executed within a Symfony2 project doctrine:generate:entities):

Generating entity "My\AppBundle\Entity\Job"

  [Doctrine\ORM\Mapping\MappingException]
  Invalid field override named 'value' for class 'My\AppBundle\Entity\Job'.

Exception trace:
 () at /path/to/project/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php:89
 Doctrine\ORM\Mapping\MappingException::invalidOverrideFieldName() at /path/to/project/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php:1922
 Doctrine\ORM\Mapping\ClassMetadataInfo->setAttributeOverride() at /path/to/project/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php:564
 Doctrine\ORM\Mapping\Driver\YamlDriver->loadMetadataForClass() at /path/to/project/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php:104
 Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain->loadMetadataForClass() at /path/to/project/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:113
 Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata() at /path/to/project/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:302
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at /path/to/project/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:212
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at /path/to/project/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:112
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata() at /path/to/project/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/MetadataFactory.php:196
 Doctrine\Bundle\DoctrineBundle\Mapping\MetadataFactory->getAllMetadata() at /path/to/project/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/MetadataFactory.php:176
 Doctrine\Bundle\DoctrineBundle\Mapping\MetadataFactory->getMetadataForClass() at /path/to/project/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/MetadataFactory.php:76
 Doctrine\Bundle\DoctrineBundle\Mapping\MetadataFactory->getClassMetadata() at /path/to/project/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/GenerateEntitiesDoctrineCommand.php:106
 Doctrine\Bundle\DoctrineBundle\Command\GenerateEntitiesDoctrineCommand->execute() at /path/to/project/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:242
 Symfony\Component\Console\Command\Command->run() at /path/to/project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:200
 Symfony\Component\Console\Application->doRun() at /path/to/project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:83
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /path/to/project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:106
 Symfony\Component\Console\Application->run() at /path/to/project/app/console:19


 Comments   
Comment by Rein Baarsma [ 27/Feb/14 ]

I have the same issue and it's easy to reproduce with a clean Symfony 2 setup with FOSUserBundle.
Once you add

 * @ORM\AttributeOverrides({
 *      @ORM\AttributeOverride(name="usernameCanonical",
 *          column=@ORM\Column(
 *              name     = "username_canonical",
 *              type     = "string",
 *              length   = 255,
 *              unique   = false
 *          )
 *      )
 * })

It will properly do doc:schema:update --force
But it will fail on doc:gen:entities (YourEntity)

Comment by Andy Waterman [ 13/Aug/14 ]

Not sure I agree this is minor - might not affect many users, but it's pretty blocking if you do run into it. Any ideas on a fix?

Comment by Marco Pivetta [ 13/Aug/14 ]

Andy Waterman you are supposed to manually edit generated entities anyway

Comment by Andy Waterman [ 19/Aug/14 ]

" you are supposed to manually edit generated entities anyway"

This applies to creating new entities as well as adapting old ones. Ie. Once you use an AttributeOverride anywhere in your project, you then cannot use generate:entities anywhere else.

Comment by Marco Pivetta [ 19/Aug/14 ]

Andy Waterman yes, and you are supposed to avoid the generator after the first run.

Comment by Andy Waterman [ 20/Aug/14 ]

You really cannot use the generate:entities command to generate method stubs in ANY of your entities or new entities after the first time you run it??

If this use case works as designed without AttributeOverride in the project, but not with AttributeOverrides, then it's a bug not us doing it wrong.

Comment by Cliff Odijk [ 20/Aug/14 ]

I agree with Andy Waterman that this is a bug if it works al the time and not when you use AttributeOverrides.

Now we just temporary remove the AttributeOverrides and then generate our stubs.

Comment by Cliff Odijk [ 12/Sep/14 ]

I tried to debug the issue and found that during the gatering of the class metadata you will get the DisconnectedClassMetadataFactory which gives the StaticReflectionService for the getParentClasses it returns an empty array which should be al the parent classes of an entity. Because of this the mapping information of the parent class does not exists and can't be overwritten.

Comment by Cliff Odijk [ 12/Sep/14 ]

If I implement the following code in the getParentClasses of the StaticReflectionService it work's like a charm

if ( ! class_exists($class)) {
            throw MappingException::nonExistingClass($class);
        }

        return class_parents($class);
Comment by Enrico Schultz [ 27/Jan/15 ]

This bug has been fixed by fixing DDC-1379. If you use protected variables in your base class, the schema is created correctly and the entity generator also does not generate properties twice. When using Symfony2, just set "doctrine/orm" to "2.4@dev" in "composer.json" or wait for an upcoming release.





[DDC-3545] Persist new object failed when it works with optimistic lock Created: 27/Jan/15  Updated: 27/Jan/15

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

Type: Bug Priority: Major
Reporter: Max Liu Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: dql, orm
Environment:

PHP 5.5



 Description   

When I was trying to persist a new object, Doctrine reported a exception:

An exception occurred while executing 'SELECT version FROM wallet WHERE user_id = ?' with params [{}]:

Catchable Fatal Error: Object of class XXXBundle\Entity\User could not be converted to string in /Users/XXX/WebSite/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php line 91

From the stack trace information, I found the original exception is:

Catchable Fatal Error: Object of class XXXBundle\Entity\User could not be converted to string

The reason is that the entity Wallet has a OneToOne mapping to entity User, and user property is also marked as primary key. When the wallet object persists, Doctrine try to fetch the new version id and use user property to find object. But Doctrine doesn't handle the primary key is an object, not a basic type. So PDO can't use a object as a query parameter.

My Entity:

class Wallet
{
    /**
     * ID
     * @var User
     *
     * @ORM\Id
     * @ORM\OneToOne(targetEntity="XXXBundle\Entity\User")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
     */
    private $user;

    /**
     * @var int
     *
     * @ORM\Version()
     * @ORM\Column(name="version", type="integer")
     */
    private $version;
}

I hope Doctrine team can solve this problem. My temporary solution is to override __toString method in User object. It is not elegant, doesn't it?



 Comments   
Comment by Marco Pivetta [ 27/Jan/15 ]

What exact version of the ORM is affected? Is master also behaving like this?

Comment by Max Liu [ 27/Jan/15 ]

It works well before I add version field. I didn't try with master version.





[DDC-3542] [GH-1287] Typo fix Created: 25/Jan/15  Updated: 26/Jan/15  Resolved: 26/Jan/15

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

Type: Documentation Priority: Trivial
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: typo


 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 26/Jan/15 ]

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

Comment by Doctrine Bot [ 26/Jan/15 ]

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





[DDC-3543] How to map and use a DB View from Doctrine2 Created: 26/Jan/15  Updated: 26/Jan/15  Resolved: 26/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers, ORM
Affects Version/s: 2.4.7
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Reynier Perez Mira Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: None


 Description   

I have a view on nomencladores schema called obtenerPaisesPorFabricanteProductoSolicitud. This is the content for the view:

    SELECT
    	ps.id AS psid,
    	ps.nombre,
    	fps.id AS fpsid
    FROM
    	(
    		(
    			nomencladores.pais ps
    			JOIN nomencladores.pais_fabricante_producto_solicitud pfps ON ((pfps.pais_id = ps.id))
    		)
    		JOIN negocio.fabricante_producto_solicitud fps ON (
    			(
    				pfps.fabricante_producto_solicitud_id = fps.id
    			)
    		)
    	);

I'm trying to map the view as follow:

    use Doctrine\ORM\Mapping as ORM;
    
    /**
     * @ORM\Entity
     * @ORM\Table(name="nomencladores.obtenerPaisesPorFabricanteProductoSolicitud", schema="nomencladores")
     */
    class ObtenerPaisesPorFabricanteProductoSolicitud
    {
        /**
         * @ORM\Id
         * @ORM\Column(name="psid", type="integer", nullable=false, unique=true)
         */
        protected $ps;
    
        /**
         * @ORM\Column(name="fpsid", type="integer")
         */
        protected $fps;
    
        /**
         * @ORM\Column(name="nombre", type="string")
         */
        protected $nombre;
    
        public function getPs()
        {
            return $this->ps;
        }
    
        public function getFps()
        {
            return $this->fps;
        }
    
        public function getNombre()
        {
            return $this->nombre;
        }
    }

But any time I run this code on it:

    $ent = $em->getRepository("AppBundle:ObtenerPaisesPorFabricanteProductoSolicitud")->findBy(
        array(
            "fps" => $entF->getId()
        )
    );

I got this result:

An exception occurred while executing 'SELECT t0.psid AS psid1,
t0.fpsid AS fpsid2, t0.nombre AS nombre3 FROM
nomencladores.obtenerPaisesPorFabricanteProductoSolicitud t0 WHERE
t0.fpsid = ?' with params [22]:
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "nomencladores.obtenerpaisesporfabricanteproductosolicitud" does not
exist LINE 1: ...d1, t0.fpsid AS fpsid2, t0.nombre AS nombre3 FROM
nomenclado...

If I remove the annotations then the error transform on this:

Class "AppBundle\Entity\ObtenerPaisesPorFabricanteProductoSolicitud" is not a valid entity or mapped super class."

Why Doctrine2 or Symfony tries to execute the query instead go through the view? How I can execute the view from Symfony2/Doctrine2 side?



 Comments   
Comment by Marco Pivetta [ 26/Jan/15 ]

Nothing wrong here: the SQL generated by the ORM is correct, but your view definition is wrong: try running the select in console, manually.





[DDC-3406] Proxy returns string instead of object Created: 21/Nov/14  Updated: 25/Jan/15

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

Type: Bug Priority: Major
Reporter: Martin Keckeis Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: orm, proxy

Issue Links:
Dependency
depends on DDC-3539 [GH-1284] #1189 DDC-3406 derived iden... Open

 Description   

I get an string in one case instead of an entity or proxy.

User -> Address -> Plant -> Hierarchy

User OneToOne Address
Address ManyToOne Plant
Plant OneToOne Hierarchy

(all are fetched as eager loading)

See PR with a test case here
https://github.com/doctrine/doctrine2/pull/1189

Reference
https://github.com/doctrine/DoctrineORMModule/issues/355



 Comments   
Comment by Doctrine Bot [ 21/Nov/14 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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





[DDC-3539] [GH-1284] #1189 DDC-3406 derived identity in proxy must be a proxy Created: 24/Jan/15  Updated: 25/Jan/15

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

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

Issue Links:
Dependency
is required for DDC-3406 Proxy returns string instead of object Open

 Description   

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

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

Message:

This is a horrible hack for #1189.

Not happy with it, this seems like it fixes just the symptom.



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 25/Jan/15 ]

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

Comment by Doctrine Bot [ 25/Jan/15 ]

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





[DDC-3531] [GH-1277] [DDC-3346] Failing test for issue (bad findOneBy behaviour with eager fetch) Created: 22/Jan/15  Updated: 25/Jan/15  Resolved: 23/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, ORM
Affects Version/s: Git Master, 2.4.7
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: collection, eager, fetch, hydration, many-to-many, onetomany, persister

Issue Links:
Dependency
depends on DDC-3534 [GH-1280] [DDC-3346] #1277 find one w... Open
is required for DDC-3346 findOneBy returns an object with part... Resolved

 Description   

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

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

Message:

Here is the test for DDC-3346(http://www.doctrine-project.org/jira/browse/DDC-3346) issue



 Comments   
Comment by Doctrine Bot [ 23/Jan/15 ]

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

Comment by Doctrine Bot [ 23/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 25/Jan/15 ]

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





[DDC-3534] [GH-1280] [DDC-3346] #1277 find one with eager loads is failing Created: 23/Jan/15  Updated: 25/Jan/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: collection, eager, fetch, hydrator, lazy-loading, many-to-many, onetomany, persister

Issue Links:
Dependency
is required for DDC-3346 findOneBy returns an object with part... Resolved
is required for DDC-3531 [GH-1277] [DDC-3346] Failing test for... Resolved

 Description   

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

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

Message:

Ping @scaytrase

Note that this is a first revision and needs refactoring, so please consider helping out with that if you can.

Ping @guilhermeblanco: please check the `CachedPersisterContext` stuff: it's dirty as heck, but that's because the persister internal generated SQL caching is inconsistent as heck too.

Resolution path for 2.4.x will be to throw an exception if there is an offset or a limit.



 Comments   
Comment by Doctrine Bot [ 23/Jan/15 ]

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

Comment by Doctrine Bot [ 23/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 25/Jan/15 ]

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





[DDC-2704] When using Discriminator EntityManager#merge fails Created: 25/Sep/13  Updated: 25/Jan/15  Resolved: 25/Jan/15

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

Type: Bug Priority: Major
Reporter: Vladyslav Petrovych Assignee: Marco Pivetta
Resolution: Fixed Votes: 2
Labels: inheritance, merge, private-properties, transient-properties, unitofwork

Issue Links:
Dependency
depends on DDC-3524 [GH-1272] [DDC-2704] - merge inherite... Resolved

 Description   

I have the following hierarchy:

  • AgentConfig has relation ManyToOne with AgentTask.
  • AgentTask has DiscriminatorColumn & DiscriminatorMap assigned to it.
  • AgentTask has relation ManyToOne with AgentTaskConfig.

I believe the problem is because of the following:

UnitOfWork#doMerge has the tries to get properties the following way:

// Merge state of $entity into existing (managed) entity
foreach ($class->reflClass->getProperties() as $prop) {

This obviously doesn't get the parent class (AgentTask) properties.

Later on UnitOfWork fails on line:

$prevClass->reflFields[$assocField]->getValue($prevManagedCopy)->add($managedCopy);

because $prevManagedCopy doesn't have properties set from entity.

My proposal is to get the properties the following way:

$properties = $class->reflClass->getProperties();
$parent = $class->reflClass;
while (($parent = $parent->getParentClass()) != null) {
    $properties = array_merge($parent->getProperties(), $properties);
}

// Merge state of $entity into existing (managed) entity
foreach ($properties as $prop) {


 Comments   
Comment by Rasmus Jensen [ 20/Jan/15 ]

I have this problem as well in .
The Merge operation does not copy properties of any parent class to the managed copy. My workaround when merging entities with inheritance is:
1. Receive detached entity that is instance of a subclass.
2. fetch a managed copy of the entity from database with id of detached entity.
3. manually set properties on the managed entity.
4. flush to save changes.

This is obviously only manageable with a relatively simple datastructure, and quickly becomes very messy with more complex entities and relationship hierarchies.

Would really appreciate a fix for this

Comment by Marco Pivetta [ 20/Jan/15 ]

A temporary workaround is to change properties into protected. I'll mark this for 2.5 and see if it can be fixed by then.

Comment by Marco Pivetta [ 25/Jan/15 ]

Handled in DDC-3524





[DDC-3524] [GH-1272] [DDC-2704] - merge inherited transient properties - merge properties into uninitialized proxies Created: 20/Jan/15  Updated: 25/Jan/15  Resolved: 25/Jan/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: inheritance, merge, private-properties, transient-properties, unitofwork

Issue Links:
Dependency
is required for DDC-2704 When using Discriminator EntityManage... Resolved

 Description   

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

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

Message:

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



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 25/Jan/15 ]

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





[DDC-3315] [GH-1140] [DDC-2704] merge throughout entity hierarchy Created: 19/Sep/14  Updated: 25/Jan/15  Resolved: 15/Jan/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Incomplete Votes: 0
Labels: inheritance, merge


 Description   

This issue is created automatically through a Github pull request on behalf of tiger-seo:

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

Message:



 Comments   
Comment by Doctrine Bot [ 15/Jan/15 ]

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

Comment by Doctrine Bot [ 15/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 25/Jan/15 ]

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





[DDC-3541] [GH-1286] Removing XDebug from non-coverage builds Created: 25/Jan/15  Updated: 25/Jan/15  Resolved: 25/Jan/15

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

Type: Improvement Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: build-speed, ci, travis, xdebug


 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 25/Jan/15 ]

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

Comment by Doctrine Bot [ 25/Jan/15 ]

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

Comment by Doctrine Bot [ 25/Jan/15 ]

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

Comment by Doctrine Bot [ 25/Jan/15 ]

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





[DDC-3537] [GH-1282] Hotfix/#1169 extra lazy one to many should not delete referenced entities (backport to 2.4) Created: 24/Jan/15  Updated: 25/Jan/15  Resolved: 25/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, ORM
Affects Version/s: 2.4.7
Fix Version/s: 2.4.8
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: delete, extra-lazy, onetomany, update

Issue Links:
Dependency
is required for DDC-3343 `PersistentCollection::removeElement`... Resolved

 Description   

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

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

Message:

See #1169

This PR backports #1281



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 25/Jan/15 ]

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





[DDC-3532] [GH-1278] travis: remove unnecessary database creation Created: 22/Jan/15  Updated: 25/Jan/15  Resolved: 24/Jan/15

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

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Incomplete Votes: 0
Labels: ci, performance, setup, travis

Issue Links:
Reference
is referenced by DDC-3540 [GH-1285] travis: remove unnecessary ... Resolved

 Description   

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

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

Message:

Ref: https://github.com/doctrine/dbal/commit/a66010640cc03e73a60cee16f1da36daabd63898

https://github.com/doctrine/doctrine2/pull/1251#discussion_r23018406



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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





[DDC-3239] [GH-1097] `expandParameters`/`getType` in BasicEntityPersister seems to really cover just few cases Created: 01/Aug/14  Updated: 24/Jan/15  Resolved: 17/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, Mapping Drivers, ORM
Affects Version/s: Git Master, 2.4.7
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: association, composite-identifier, custom-dbal-type, identifier, persister

Issue Links:
Duplicate
duplicates DDC-3380 [GH-1178] Fixing associations using U... Resolved
Reference
is referenced by DDC-3380 [GH-1178] Fixing associations using U... Resolved

 Description   

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

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

Message:

The test case below seems fairly simple, but I believe that it might uncover a bigger issue.

It seems odd that [`getType` (and, hence, `expandParameters`)](https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php#L1731-1795) in BasicEntityPersister clearly expects field name but often gets different things.

Just set a breakpoint there and watch values through the test suite. There might be not just field name, but a column with alias as well. This works:
![screenshot from 2014-08-01 14 03 44](https://cloud.githubusercontent.com/assets/231518/3778796/c5cc3e66-1979-11e4-9279-5c322b7e8402.png)

But this, apparently, doesn't:
![screenshot from 2014-08-01 14 07 29](https://cloud.githubusercontent.com/assets/231518/3778816/20da192c-197a-11e4-90b4-4c37ee454fb6.png)

There are multiple places (more than one) that call `expandParameters` with criteria that can't be resolved with `getType`. Is this situation expected or worth further investigation/fixing?



 Comments   
Comment by Marco Pivetta [ 17/Jan/15 ]

Handled in DDC-3380

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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





[DDC-3380] [GH-1178] Fixing associations using UUIDs Created: 09/Nov/14  Updated: 24/Jan/15  Resolved: 17/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, Mapping Drivers, ORM
Affects Version/s: Git Master
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: association, composite-identifier, custom-dbal-type, identifier, persister

Issue Links:
Dependency
is required for DDC-3373 [GH-1174] Fix associations with a cus... Resolved
Duplicate
is duplicated by DDC-3239 [GH-1097] `expandParameters`/`getType... Resolved
is duplicated by DDC-3373 [GH-1174] Fix associations with a cus... Resolved
Reference
relates to DDC-3239 [GH-1097] `expandParameters`/`getType... Resolved

 Description   

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

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

Message:

This is a port of #1174.

I was running an experiment using a custom DBAL type, which converts a UUID string (in PHP) to 16 bytes binary string (in SQL) and vice versa, as identifier for a couple of entities. I noticed some associations weren't loaded correctly. This PR attempts to fix that issue.

_Remaining issue_

There are 2 tests that involve OneToOne and OneToMany associations with composite ids of which one is a foreign one. When the owning side is fetched from the DB, a Proxy object is created for the inversed side. But this Proxy contains incorrect identifiers:

public $id => string(36) "12345678-9abc-def0-1234-56789abcdef0"
public $foreignEntity => string(16) "????????????????"

Those question-marks represent 16 bytes of binary data. The thing is that `$foreignEntity` should contain another Proxy object (or perhaps the UUID of the foreign entity, I'm not sure).

I'm at a loss here Hopefully someone can point me to where identity through foreign Entities is managed!



 Comments   
Comment by Doctrine Bot [ 09/Nov/14 ]

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

Comment by Doctrine Bot [ 09/Nov/14 ]

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

Comment by Doctrine Bot [ 10/Nov/14 ]

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

Comment by Jasper N. Brouwer [ 10/Nov/14 ]

Affects Versions: master (2.5) and 2.4 are confirmed, but I suspect this goes back to all versions.

Comment by Doctrine Bot [ 17/Jan/15 ]

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





[DDC-3535] Allow binding `Parameter` value object to statements, removing the need for explicit value and type passing Created: 24/Jan/15  Updated: 24/Jan/15

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

Type: Task Priority: Critical
Reporter: Marco Pivetta Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: binding, criteria, parameters, persister, repository, type


 Comments   
Comment by Marco Pivetta [ 24/Jan/15 ]

We currently have a lot of locations in the code where we use list($values, $types) = $this->computeParameters(); (pseudo-code).

This leads to a lot of code duplication and complexity.

Maybe a Parameter VO may be used instead, or a ParameterCollection with a fixed $types and a mutable $values, and with minimal internal validation.





[DDC-3062] [GH-997] [FIX] Allow to use ManyToMany with all operators Created: 31/Mar/14  Updated: 24/Jan/15

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

Type: Bug Priority: Critical
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

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

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

Message:

Hi,

ping @guillhermoblanco : I think this may be blocking for 2.5

I introduced not so long ago support for ManyToMany for Criteria. However, I realized my implementation was really incomplete, because I hard-coded the "=" operator (https://github.com/doctrine/doctrine2/pull/885/files#diff-982b7374bbe9d5f4b6b71f4869a446eaR575). This means that it fails in a lot of cases when you use something different than "eq" for Criteria.

This PR fixes that, however it's a bit hacky. The SqlExpressionVisitor was made by type hinting for a BasicEntityPersister, preventing us from using us for a collection persister. Therefore I added a new interface to keep BC.

There is also a lot of code duplication (the whole "getSelectConditionSQL" was copied from the BasicEntityPersister), but without trait or BC, I have no idea about how to solve it.

All tests pass, test were added for other operators.



 Comments   
Comment by Doctrine Bot [ 13/Jan/15 ]

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

Comment by Doctrine Bot [ 13/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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





[DDC-3130] [GH-1033] [WIP] Lazy criteria for ManyToMany collection Created: 18/May/14  Updated: 24/Jan/15

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

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

Issue Links:
Reference
is referenced by DDC-2535 [GH-712] Extra lazy get for inverse s... Resolved

 Description   

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

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

Message:

This continues my previous work on making Criteria most efficient.

Currently we are wrapping matching calls on repositories and matching calls on EXTRA_LAZY associations around a LazyCriteria. However, ManyToMany are still completely loaded: https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/PersistentCollection.php#L874

This is still problematic from a performance point of view because count, contains... cannot be optimized. I think the solution is similar to previous one, hence creating a Lazy collection for that kind of associations.

However, this is really tricky to do because of the whole mess inside the persisters (can't wait for them to be completely refactored, it's getting really hard to maintain this mess ).



 Comments   
Comment by Doctrine Bot [ 13/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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





[DDC-3529] [GH-1275] [WIP] Nullable embedded objects. Created: 21/Jan/15  Updated: 24/Jan/15

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

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


 Description   

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

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

Message:

The idea was to have a simple (and clean) way to override the nullable property of embedded objects, so I've
added the ```nullable``` attribute on the ```@Embedded``` annotation and it have 3 possible values:

  • NULL: The nullable option that was defined on the attributes of the embeddable class won't be overriden;
  • TRUE: All attributes of the embeddable class will be marked as nullable and the embeddable instance only would be created when data is not NULL;
  • FALSE: All attributes of the embeddable class will be marked as non-nullable.

There's a lot of things to be improved (mostly on UnitOfWork), but it's fully working with basic tests as you can see on ValueObjectsTest::testCRUDOfNullableEmbedded() case.

I would appreciate a lot your opinions!



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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





[DDC-3515] [GH-1263] #1223 DDC-3453 - make `EntityManager` constructor `public` Created: 18/Jan/15  Updated: 24/Jan/15

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

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: constructor, entitymanager, setup

Issue Links:
Reference
is referenced by DDC-3453 [GH-1223] Refactored construction of ... Resolved

 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 18/Jan/15 ]

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

Comment by Doctrine Bot [ 18/Jan/15 ]

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

Comment by Doctrine Bot [ 18/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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





[DDC-3510] [GH-1261] Add a new QuoteStrategy that automatically escape database reserved keyword Created: 16/Jan/15  Updated: 24/Jan/15

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

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


 Description   

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

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

Message:

All the upload screenshots which are used to explain what we are doing are taken from a real project developed with Mouf dependency injection framework (http://mouf-php.com/) that we use to configure the entity manager.

We wanted to create a FAQ where admin can add question/answer and use drag and drop to set the position of the question in the FAQ.

For this, at some point, in an entity, we used a protected keyword "order" in a class FAQ:

```
/**

  • @ORM\Column(type="integer", nullable=false)
  • @var int
    */
    private $order;
    ```

This fails with Doctrine. The documentation clearly explains why: http://doctrine-orm.readthedocs.org/en/latest/reference/basic-mapping.html#quoting-reserved-words

Below are a list of screenshot explaining we use the `DefaultQuoteStrategy` and the failure message we get.

![doctrineconfiguration](https://cloud.githubusercontent.com/assets/8350192/5779969/4ab5c15e-9da7-11e4-8df8-f2c718c8d66a.PNG)

In the configuration,the "quoteStrategy" setter is not set. Therefore, we use `DefaultQuoteStrategy`.

![defaultquotestrategy](https://cloud.githubusercontent.com/assets/8350192/5779977/51fe0a70-9da7-11e4-9cfa-3a86e6f8aab8.PNG)

We get this error:

![error](https://cloud.githubusercontent.com/assets/8350192/5779963/422e0bc2-9da7-11e4-902c-602a2eac7f96.PNG)
We get an error while using doctrine ORM because it doesn't auto escape protected keyword. (We can protect it manually by using ` .)

We created a new QuoteStratigy that automaticcaly escape protected keyword *only*. We just bind it via the Mouf interface:

![escapingquotestrategy](https://cloud.githubusercontent.com/assets/8350192/5780067/d9997bae-9da7-11e4-8a23-c5fa2ebaffcc.PNG)

and then the magic begins: a screenshot of the page with no error.

![succes](https://cloud.githubusercontent.com/assets/8350192/5780085/f9b597f6-9da7-11e4-85b0-cd09fb572cd9.PNG)

We would like to submit this new `EscapingQuoteStrategy` as we think it will be easier for developers to work with it, and it should not have a big performance impact (only an additional lookup in a table)



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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





[DDC-3507] [GH-1260] Added PersisterFactory to ORM. Created: 16/Jan/15  Updated: 24/Jan/15

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

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


 Description   

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

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

Message:



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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





[DDC-3481] [GH-1241] [3.0] [POC] lazy-load on a per-property base Created: 09/Jan/15  Updated: 24/Jan/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved 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/1241

Message:

This is just a proof of concept that I hacked together real quick.

This changes how proxies are generated and lazy-loaded in a very radical way:

  • method calls do not cause lazy-loading
  • lazy-loading is triggered by access to non-transient properties (things that need to be lazy-loaded)
  • access to identifiers or non-mapped properties won't cause lazy-loading

Following BC breaks need to be fixed or discussed before going forward on this idea:

  • [ ] proxies don't implement `Doctrine\Common\Proxy\Proxy` anymore, but `ProxyManager\Proxy\GhostObjectInterface` (BC break, needs fixing, can be easily done with some effort)
  • [ ] `serialize($proxy)` now causes proxy initialization (probably needs fixing, as this is a major BC break)

Pending TODOs:

  • [ ] cloning a proxy is still not fully supported (requires dedicated logic in `__clone`)
  • [ ] this is just a PoC, so the code that writes proxies to disk is not yet in place


 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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





[DDC-3458] [GH-1228] Fixed many small phpcs issues Created: 19/Dec/14  Updated: 24/Jan/15

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

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


 Description   

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

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

Message:

This pr fixes many small phpcs issues



 Comments   
Comment by Doctrine Bot [ 19/Dec/14 ]

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

Comment by Doctrine Bot [ 24/Jan/15 ]

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





[DDC-3455] [GH-1225] Test for RuntimeException in AnnotationExporter::exportClassMetadata() Created: 19/Dec/14  Updated: 24/Jan/15

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

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