### [DDC-274] Class and namespace naming inconsistency Created: 24/Jan/10  Updated: 31/Oct/10

Status: In Progress
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: 2.0-ALPHA4
Fix Version/s: 2.0-RC1
Security Level: All

 Type: Improvement Priority: Critical Reporter: Glen Ainscow Assignee: Roman S. Borschel Resolution: Unresolved Votes: 1 Labels: None

 Description
 There are inconsistencies with some class and namespace names that include acronyms. Examples: Classes with upper-casing: ORMException, DBALException, OCI8Connection, etc. Classes with proper-casing: RunDqlTask, CliException, MySqlPlatform, etc. Namespaces with upper-casing: DBAL, ORM, Doctrine\DBAL\Driver\PDOMsSql, etc. Namespaces with proper-casing: Doctrine\Common\Cli, Doctrine\DBAL\Tools\Cli\, Doctrine\ORM\Id, etc. There is more proper-casing than upper-casing. IMHO, proper-casing is better as it's easier to read "SqlException" than it is to read "SQLException" (the "E" looks like part of the acronym), and things like "CLITask" can be avoided. I discussed this a bit with Benjamin and Guilherme, and they were unsure and said that the whole team needed to reach consensus. I'm leaving the priority as "Major" because this should probably be fixed sooner rather than later to prevent compatibility breaks.

### [DDC-536] Remove the _ prefix from private and protected members Created: 23/Apr/10  Updated: 19/Nov/10

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

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

 Description

### [DDC-1729] Translate queries into graphs of value objects (instead of array hydration?) Created: 27/Mar/12  Updated: 09/Jun/12

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

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

 Description
 In decoupled applications the model layer returns "data-transfer-objects" through the boundary into the controller/view layer. It would make sense to have Doctrine directly generate any data-transfer/value-object from native and dql queries.

 Comment by Benjamin Eberlei [ 09/Jun/12 ] Example: $dql = "SELECT new CustomerAddressView(c.id, c.name, a.id, a.street, a.number, a.city, a.code) FROM Customer c INNER JOIN c.address a WHERE c.id = ?1";  This supersedes DDC-1819. 1. One additional property in ResultSetMapping =>$viewModelClass? 2. Changes to Parser (new ... syntax) 3. Changes to sQL Walker? 4. Changes to Hydration (Only object hydration!)

Status: Open
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

 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-763] Cascade merge on associated entities can insert too many rows through "Persistence by Reachability" Created: 23/Aug/10 Updated: 04/Jul/11 Status: Open Project: Doctrine 2 - ORM Component/s: ORM Affects Version/s: None Fix Version/s: 2.x Security Level: All  Type: Improvement Priority: Major Reporter: Dave Keen Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 2 Labels: None  Attachments: 0149-DDC-763.patch DDC763Test.php multipleaddmerge.diff  Description  I think that the UnitOfWork needs to maintain a map of spl_object_hash($newEntity)->$managedEntity for entities that were persisted via reachability during a merge. doMerge should then only call persistNew if the original entity has not already been persisted (if it has already been persisted it should merge the managed entity from the map). The map should be maintained until a flush() or until the UnitOfWork is cleared. The reasoning is as follows. Imagine we have a simple doctor object with no associations: $doctor = new Doctor(); $em->persist($doctor); $em->persist($doctor); $em->flush();  After the first persist()$doctor is MANAGED so the second persist has no effect and this results in a single Doctor row. If we do the same thing using merge and persistence by reachability: $doctor = new Doctor();$em->merge($doctor);$em->merge($doctor);$em->flush();  we get 2 Doctor rows being added. Obviously in this particular case we should use the return value from the first merge() as the parameter of the second merge which would give correct behaviour. However, now imagine one Doctor has many Patients and many Patients have one Doctor, all the associations have cascade merge enabled, and further assume that $d1 (Doctor id=1) is already in the database. We now attempt to create two patients and assign them to the existing doctor: $d1= new Doctor(); $d1->id = 1; // This is a DETACHED entity$p1 = new Patient(); $p2 = new Patient();$d1->patients->add($p1);$p1->doctor = $d1;$d1->patients->add($p2);$p2->doctor = $d1;$em->merge($p1);$em->merge($p2);$em->flush();  This actually results in 4 rows being added to the 'patients' table instead of 2, I think because $p1 and$p2 are getting persisted both as the root objects and then again from the patient->doctor->patients array. Since the cascade merging happens internally we can't replace the array contents with the managed return values without walking through the object graph (in which case there is no point in using cascade merge in the first place). Maintaining a map in UnitOfWork will allow doMerge to ensure it doesn't persist the same entities twice. I'm not sure, but this might be relevant for cascade persist too. P.S. Another bug report on this can be found at http://code.google.com/p/flextrine2/issues/detail?id=32 (it basically says the same thing with different entities).

 Comment by Benjamin Eberlei [ 29/Aug/10 ] @Roman A possible fix for this in my opinion is another map in UnitOfWork $mergedEntities = array(); and a patch like this: diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 242d84b..1d0d8b3 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -1340,6 +1340,10 @@ class UnitOfWork implements PropertyChangedListener return; // Prevent infinite recursion } + if (isset($this->mergedEntities[$oid])) { + return$this->mergedEntities[$oid]; + } +$visited[$oid] =$entity; // mark visited $class =$this->em->getClassMetadata(get_class($entity)); @@ -1468,6 +1472,8 @@ class UnitOfWork implements PropertyChangedListener$this->cascadeMerge($entity,$managedCopy, $visited); +$this->mergedEntities[$oid] =$managedCopy; + return $managedCopy; }  Comment by Dave Keen [ 29/Aug/10 ] I have tested this patch with my application and it fixes the problem in all my relevant test cases apart from one. The test case that's failing is one that persists a bi-directional many to many relationship, so the associations interweave with each other (if you know what I mean). I wonder if perhaps doMerge need to continue cascading even if it finds an item in$this->mergedEntities This is the Flextrine code that fails - it results in no entries in movie_artist. This might also be related to DDC-758? m1 = new Movie(); m1.title = "Movie 1"; m2 = new Movie(); m2.title = "Movie 2"; a1 = new Artist(); a1.name = "Artist 1"; a2 = new Artist(); a2.name = "Artist 2"; m1.artists.addItem(a1); a1.movies.addItem(m1); m1.artists.addItem(a2); a2.movies.addItem(m1); m2.artists.addItem(a1); a1.movies.addItem(m2); m2.artists.addItem(a2); a2.movies.addItem(m2); // These translate to cascade merges on the server em.persist(m1); em.persist(m2); em.persist(a1); em.persist(a2); // Now flush em.flush(); Comment by Dave Keen [ 29/Aug/10 ] P.S. This test passes if I translate em.persist() to $em->persist() (not cascading) on the server instead of translating it to a cascade merge; not sure if that helps Comment by Roman S. Borschel [ 30/Aug/10 ] I'd really like to avoid introducing an additional instance variable just to solve this issue but I did not find the time yet to really look into it. Does someone have a unit test for this already and can attach it to the issue? Comment by Roman S. Borschel [ 31/Aug/10 ] Rescheduling for RC1. Comment by Dave Keen [ 13/Sep/10 ] Here is a functional test case containing three tests: testMultiMerge tests basic merging of two new entities, checking that only a single entity ends up in the database. This passes with Benjamin's patch. testMultiCascadeMerge tests the more complex case of merging a OneToMany association. This also passes with Benjamin's patch. testManyToManyPersistByReachability tests the ManyToMany case described above and this fails with Benjamin's patch, probably because doMerge doesn't cascade down entities that it has already merged and some ManyToMany associations are being ignored. Its a bit hard to be certain what is causing this as even without Benjamin's patch this test would fail due to DDC-758. Comment by Benjamin Eberlei [ 15/Sep/10 ] @Roman i thought about this issue, its not possible without that additional map of merged entities. There is no way we can get that information from other sources. Problem is rather that the use-case probably only applies in mass-merging scenarios and client-server serialization. Comment by Dave Keen [ 21/Sep/10 ] Added another failing test case - adding the same entity from different ends of a many to many bi-directional association to check that there isn't an integrity constraint violation caused by Doctrine trying to add the same row twice. Comment by Dave Keen [ 21/Sep/10 ] Attached a patch for this issue. Comment by Benjamin Eberlei [ 22/Sep/10 ] can you comment why all the additionall stuff is necessary compared to my patch? Comment by Dave Keen [ 22/Sep/10 ] It fixes the two additional test cases - testManyToManyPersistByReachability and testManyToManyDuplicatePersistByReachability. testManyToManyPersistByReachability was failing with your original patch because there are ManyToMany cases where an entity may have already been merged, but its still necessary to add it to an association and continue to cascade. Running the following with the original patch will miss out some of the associations. $m1 = new Movie(); $m1->title = "Movie 1";$m2 = new Movie(); $m2->title = "Movie 2";$a1 = new Artist(); $a1->name = "Artist 1";$a2 = new Artist(); $a2->name = "Artist 2";$m1->artists->add($a1);$a1->movies->add($m1);$m1->artists->add($a2);$a2->movies->add($m1);$m2->artists->add($a1);$a1->movies->add($m2);$m2->artists->add($a2);$a2->movies->add($m2);$em->merge($a1);$em->merge($a2);$em->flush();  The other change in my patch is to protect against this case. It ensures that the following code doesn't add the same entity twice to a collection. $em->merge($m1); $em->merge($m2); $em->merge($a2); $em->merge($a2); $em->flush();  Comment by Benjamin Eberlei [ 31/Oct/10 ] I am not sure if the issue here is rather multiple calls to merge that contain different parts of the same object-graph. There should be a very simple fix for this, call ->clear() after each merge. I am not sure if this patch drags us into a blackhole of issues with merging. Comment by Dave Keen [ 31/Oct/10 ] Calling ->clear() and ->flush() after each merge is a workaround for the simple case, but unless I am misunderstanding I don't think its a solution for cases where the merging is happening automatically in cascadeMerge. I've actually encountered this issue in another project and scenario to do with creating REST APIs and merging JSON objects into entities, and applying the patch fixed it so a) I think this issue might be a more common that we first thought and b) the patch basically seems to work (plus it doesn't introduce any failing cases in the existing test suite). I can actually still find one edge case to do with cascading merging interlinked many to many associations that this doesn't fix, but I was planning to open that as a new ticket after this My feeling is that the current merge already has issues and this definitely improves it. Comment by Benjamin Eberlei [ 01/Nov/10 ] It cannot happen inside a single merge, single merges use the$visited to avoid infinite recursions, each entity can only be merged once inside a single merge operation. Comment by Benjamin Eberlei [ 10/Nov/10 ] Added a note into the documentation about using EntityManager#clear between merging of entities which share subgraphs and cascade merge. Handling this issue in UnitOfwork will be declared an improvement, not a bug anymore and be scheduled for later releases. The required changes to the core are to dangerous and big. Comment by Dave Keen [ 11/Nov/10 ] Where in the docs is that? Just to summarize, the equivalent operation to having multiple merges and a single flush is to call merge followed by flush each time, with the whole thing surrounded by a transaction? Does this have a big impact on performance? Comment by Dave Keen [ 11/Nov/10 ] Ben - even given the decision not to implement this (and I do understand your thinking, as it is a major change), is there any reason not to implement the bit that ensures that the same entity isn't added to a collection twice during a merge? I can't think of a situation where this should be allowed, and I have a use case where I get 'DUPLICATE KEY' errors if this isn't there. Please see attached patch. Comment by Benjamin Eberlei [ 11/Nov/10 ] What bit of that huge patch is that? Can you extract it into another ticket if thats possible? Comment by Benjamin Eberlei [ 11/Nov/10 ] I added it to "Working with Objects" and the descripton of Merge. Its not yet live on the site. Using this current workaround has a performance impact, since more SELECT statements have to be issued against the database. Comment by Dave Keen [ 11/Nov/10 ] Apologies for not being clear - only the 3rd patch (multipleaddmerge.diff) is relevant to the 'DUPLICATE KEY' error I am now talking about, but I'll put it in a nother ticket if you prefer. Comment by Benjamin Eberlei [ 11/Nov/10 ] please add a new ticket, patch looks good. Comment by Dave Keen [ 11/Nov/10 ] Created as DDC-875

### [DDC-676] Find a way to test serialize/unserialize of all ClassMetadata properties in isolation Created: 10/Jul/10  Updated: 29/Aug/10

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

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

 Description
 We should find a way, using PHPUnit Data Providers or anything else, to check the serialize/unserialize of every property in the ClassMetadata instance, since errors here can be very subtle but dangerous.

### [DDC-667] Lock Timeout Query Hint for DQL Queries Created: 04/Jul/10  Updated: 16/Sep/10

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.0-BETA2
Fix Version/s: 2.x
Security Level: All

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

 Description
 After the implementation of DDC-178 there is now only outstanding the support for locking queries based on a given timeout. This will be a DQL query feature only and be available via a query hint: $query->setHint(Query::LOCK_TIMEOUT,$timeoutMs);  It will be only working on Oracle.

 Comment by Roman S. Borschel [ 30/Aug/10 ] If this is to be implemented for 2.0, it needs to happen for RC1, therefore rescheduling to RC1. Feel free to reschedule to 2.x if necessary. Comment by Benjamin Eberlei [ 16/Sep/10 ] Only oracle supports lock timeouts and no other vendor seems to plan to support it. I move to 2.x, but i guess this would rather be an issue of user extension.

Allow @Id on @ManyToOne fields (DDC-117)

### [DDC-658] Reverse engineering with Oracle (DBDriver and Associations as Identifier) Created: 27/Jun/10  Updated: 11/Dec/11

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

 Type: Sub-task Priority: Major Reporter: Mickael Perraud Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 1 Labels: None Environment: Ubuntu 10.04 + Oracle 11g Entreprise + PHP 5.3.2 + Doctrine2 Git (up-to-date)

 Description
 I am playing with reverse engineering with Oracle and I have some problems: My schema: drop table PHONE_NUMBER; drop table CUSTOMER; create table CUSTOMER ( CUSTOMER_ID NUMBER(4) not null, CUSTOMER_LASTNAME VARCHAR2(50) not null, CUSTOMER_MODIFIED DATE, constraint PK_CUSTOMER primary key (CUSTOMER_ID) using index tablespace TBS_INDEX storage ( initial 100K next 100K ) ) storage ( initial 100K next 100K ) tablespace TBS_DATA; create table PHONE_NUMBER ( PHONE_NUMBER_ID NUMBER(4) not null, CUSTOMER_ID NUMBER(4) not null, PHONE_NUMBER VARCHAR2(50) not null, PHONE_NUMBERMODIFIED DATE, constraint PK_PHONE_NUMBER primary key (PHONE_NUMBER_ID, CUSTOMER_ID) using index tablespace TBS_INDEX storage ( initial 100K next 100K ) ) storage ( initial 100K next 100K ) tablespace TBS_DATA; alter table PHONE_NUMBER add constraint PHONE_NUMBER__CUSTOMER foreign key (CUSTOMER_ID) references CUSTOMER (CUSTOMER_ID);  I obtain "Fatal error: Uncaught exception 'Doctrine\ORM\Mapping\MappingException' with message 'Property "customerId" in "PhoneNumber" was already declared, but it must be declared only once'" It's because a foreign key is a component of the primary key.

 Comment by Mickael Perraud [ 28/Jun/10 ] This is the continuation of http://www.doctrine-project.org/jira/browse/DDC-616. Only the schema is different. Comment by Benjamin Eberlei [ 28/Jun/10 ] just for understanding this scenario: Is this a One-To-One relation and the TABLE_TEST2 "inherits" the primary key from its parent TABLE_TEST1? If yes, this construct is not yet supported by Doctrine 2, we still need to include an ID-Generator that supports this kind of schema. Comment by Mickael Perraud [ 28/Jun/10 ] Change for a more understandable use case. Note that it's not my real use case and that I work on legacy database on which I can't change the structure. Comment by Benjamin Eberlei [ 01/Jan/11 ] updated the issue topic to get a better grasp of what needs to be done here. Comment by waldo [ 09/Jun/11 ] I have the same error with Mysql whit the same condition. Comment by Benjamin Eberlei [ 28/Nov/11 ] More details on the work to be done: The relevant code is in Doctrine/ORM/Mapping/Driver/DatabaseDriver.php only. The idea is currently many-to-many tables are detected by checking that the table has foreign keys on all the primary key columns (no additional columns!) Now with the 2.1 feature of foreign key/primary key entities this is not necessarily true anymore. You can have the primary keys being foreign keys BUT have additional columns that are not part of the primary key. This has to be detected. If a foreign key-primary-key entity is found that has additional columns a ClassMetadata has to be created and the associations have to be created with the "id" => true flag in mapManyToOne(). Comment by Scott Steffens [ 11/Dec/11 ] For what it's worth, I'm getting this error when I have a PK that is a single column and not a FK. PRIMARY KEY (id), UNIQUE KEY cycle_station_id (cycle,station_id), KEY station_id_idx (station_id), KEY readings (readings), KEY source (source), KEY temperature_min_max (temperature_max,temperature_min), KEY station_id_cycle (station_id,cycle,updated_at), CONSTRAINT compiled_1_station_id_stations_id FOREIGN KEY (station_id) REFERENCES stations (id), CONSTRAINT compiled_1_station_id_stations_id_1 FOREIGN KEY (station_id) REFERENCES stations (id) ON DELETE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=160833690 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

### [DDC-624] Partial object query that leaves out an association to avoid loading it fetches the association anyway. Created: 03/Jun/10  Updated: 11/Nov/11

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

 Type: Bug Priority: Major Reporter: Roman S. Borschel Assignee: Roman S. Borschel Resolution: Unresolved Votes: 2 Labels: None

 Duplicate is duplicated by DDC-1465 Fetching partial objects doesn't work... Open

 Description
 Assuming: Customer Cart where Cart is the owning side. Since the association from Customer to Cart can not be lazy, it would make sense to leave out the association in a query to avoid loading the carts like this: select partial c.{id,name, ... anything except cart} from Customer c"  But this is ignored and the carts of all customers are fetched anyway. Query::HINT_FORCE_PARTIAL_LOAD is an alternative solution, however it has the disadvantage that it disables lazy-loading for all queried objects. If partial querying would honor associations this would allow more fine-grained control.

 Comment by Roman S. Borschel [ 26/Aug/10 ] Might need to be pushed back to a 2.0.x / 2.x.x bugfix release. Not clear yet.

### [DDC-1216] A way to mark an entity to always use result cache. Like @UseResultCache class annotation. Created: 19/Jun/11  Updated: 06/Apr/12

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

 Type: New Feature Priority: Major Reporter: Reio Piller Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 2 Labels: None

 Description
 So that even associations, find(), findBy() etc will be affected. Very useful for entities that are being used on every request. Is that thinkable?

### [DDC-1852] Doctrine\ORM\Tools\SchemaValidator should check validity of lifecycle callbacks Created: 04/Jun/12  Updated: 07/Sep/13

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

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

 Description
 The schema validator should analyze mapped lifecycle callbacks and: a) if some lifecycle callbacks were defined, but no @HasLifecycleCallbacks annotation/mapping was set, warn the user b) if some lifecycle callbacks were defined, but methods are not public, warn the user

 Comment by Marco Pivetta [ 04/Jun/12 ] Existing PR at https://github.com/doctrine/doctrine2/pull/361

### [DDC-1264] Add more math related DQL funcs (trig, round, stuff?) Created: 09/Jul/11  Updated: 09/Jul/11

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

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

### [DDC-298] Allow Entity to hold a collection of a single primitive type Created: 02/Feb/10  Updated: 10/Oct/13

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

 Type: New Feature Priority: Major Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 4 Labels: None

 Description
 Sometimes you want to save arbitrary information for an entity using a key -> value array-structure. JPA supports this by means of the @ElementCollection annotation with allows to specify HashMaps for example. I propose a new AssocationMapping called "ElementMapping" / "ElementCollection" and annotations (options): ElementCollection + elementTable + keyType + keyLength + keyColumnDefinition + valueType + valueLength + valueColumnDefinition  The key and value definitions are necessary for converting and schema generation. The implementation would make use of the PersistentCollection at all times and work as any other persistent collection just with primitive types. Restrictions for a first implementation: Only available as a Lazy-Load Collection, no hydration with the source entity Can't be used in queries alike "entity.colname.key = ?1" Use-Case: $entity->options['foo'] = 'bar';$entity->options['bar'] = 'baz';  This could be done for 2.0 imho, adding the necessary changes and optimizations could then be scheduled for 2.1

 Comment by Benjamin Eberlei [ 02/Feb/10 ] In this implementation Schema-Tool would generate a table: elementTable (entity_id-1, ..., entity_id-n, key, value) and using the Platform Type Generation of keyType and valueType Comment by Benjamin Eberlei [ 02/Feb/10 ] Column Names should be Change-able also since there could be people who name their primary keys "key" and "value" o_O Comment by Benjamin Eberlei [ 02/Feb/10 ] Ordering could be implemented on top of this using the @OrderColumn JPA implementation by adding another column to the table with a numeric order that will be "order by"'d on select time. Comment by Benjamin Eberlei [ 24/Dec/10 ] Pushed back Comment by Richard Michael Coo [ 10/Oct/13 ] Any news on this? It has been almost 3 years since its last update =)

### [DDC-213] Persist order of collections Created: 15/Dec/09  Updated: 16/Oct/12

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

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

 Duplicate is duplicated by DDC-181 Order of many-to-many relationship Resolved Reference is referenced by DDC-250 ArrayCollection Key Column @indexBy Resolved

 Description
 A Collection is like a php array, an ordered map. Hence there should be the possibility to persist this order.

 Comment by Christian Heinrich [ 21/May/10 ] Roman, I'd like to do this one as I have currently a use case for this. Do you have any idea of how to do this? What I'm wondering is whether it is possible to implement this without user intervention. (This would simply mean "store the entities as they were added"). But this would need another column in DB that we'd have to add within oneToMany / manyToMany relationships, but in this case one could save a serialized array holding "entityId => position" key / value pairs. Afterwards, one could easily rebuild / reorder the collection via $collection->set($entity, $order[$entity->identifier]); If you've got another thought about this, please don't hesitate to point me into the right direction! Comment by Benjamin Eberlei [ 22/May/10 ] this won't be implemented until 2.1, since its a pretty complex feature. Changes are probably required in: 1. CollectionPersister - Add a new collection persister that takes the position into account 2. SchemaTool - Add a 'col_position' column to either the many-to-many or the one-to-many tables. 3. EntityPersister - Use and extend current order-by support to make the sorting happen You can implement this already though with some performance hit in update scenarios. If you use the ORDER BY support and implement an API around your entity that abstracts those changes and always sets a "position" field on the many entity that is supposed to be sorted. Comment by Roman S. Borschel [ 22/May/10 ] I don't think we necessarily need a new collection persister. Simply adjusting the ManyToManyPersister to be able to deal with it might be sufficient. For OneToMany, that is always persisted from the "many" side, thus there is no collection persister, we would need to adjust the normal persisters. They key element for the user should be a new annotation (or corresponding xml/yaml element) @OrderColumn. By default the order should not be persistent, only when an @OrderColumn annotation is present. The name of the order column can have a default, i.e. "position". Thus this enhancement of persisting the order should be fully backwards compatible. Comment by Roman S. Borschel [ 22/May/10 ] On another note, the getInsertDiff/getDeleteDiff methods of PersistentCollection should already be "ready" for this. That is, when an element in the collection changed only its position, this is already tracked as a change. However the ManyToManyPersister issues no "UPDATE" queries, it simply deletes and inserts. A position change may be more effectively persisted with an UPDATE. Comment by Benjamin Eberlei [ 30/Sep/10 ] From a mailinglist entry, required check/changepoints: 1. ClassMetadata of Many-To-Many associations have to be extended to publish the required datastructure to the ORM. 2. All Metadata Mapping Drivers have to be extended 3. Persisters\ManyToManyCollectionPersister has to be extended to save the key in the many to many table if desired by the user. 4. Schema-Tool has to be extended to create the additional column. 5. PersistentCollection has to be extended so that lazy loading of collections with additional key works. 6. Array- and ObjectHydrator have to be extended to allow fetch join of collections with key column. 7. Discuss wheather to support this for One-To-Many also with the key-column on the many side. This is much more tricky internally though. Comment by Benjamin Eberlei [ 24/Dec/10 ] Push back to 2.x, we will have support for DDC-250 first and for this at a later release. Comment by Thomas Tourlourat - Armetiz [ 07/Feb/12 ] Hi there, I'm looking for this feature. Benjamin Eberlei said that : "You can implement this already", but I don't understand the "how to". Also, The problem should be solve if RDBMS had a "natural" order. An order based on item position inside table. To get this feature without any change on Doctrine, I have remplace the PK defined by the target & mapped field identifier. The new PK is a new field with type "integer" and with auto-increment enable. In this configuration, Doctrine use the "natural" order of the RDBMS. And I can change order of my item inside Collection and persist it. It's an very bad solution, but It work before an official support. Waiting for advices, and solutions, Thomas. Comment by Thomas Tourlourat - Armetiz [ 08/Feb/12 ] Answering to Benjamin Eberlei on the "7. Discuss wheather to support this for One-To-Many also with the key-column on the many side. This is much more tricky internally though.". I think that for One-To-Many relations, if user want to store the collection order, Doctrine can store the One-To-Many as Many-To-Many with a "model" limitation. In that case, if storing order collection for Many-To-Many work, it should work for One-To-Many. What do you think about it ? Comment by Nicolas [ 29/Feb/12 ] I think that it must be possible to have two keys ordering : the order isn't obligatory reversible. For exemple with user and group : You can order groups for one user : with preference by exemple, or importance. And with a different order, users for a group : rank by example. And maybe more, if you decide to add multi-order : an user show group by his rank in it, if his rank is identical, the order is make by love preference, and after by the importance given by the user (not necessary a number, if we imagine filter on them). So a default order can be choice with parametized fields and could be :  @ManyToMany(targetEntity="Group") ... @JoinFields ( rank: { type: int} , preference:{type:int}, importance:{type: string, length: 40} ) @OrderByJoinFields({"rank" = "ASC", "preference"="ASC", "importance"="ASC" } )  In this case the order must be optional and would be clean if another order appears in the same scope (DQL...). And manytomany became virtual entities act as other entities except they don't appears permetting in the same time a better conception. So if the solution take in DDC-181 will become the only solution. This would a good idea to document this. Because, this seems to me a very important point. My last point is even an unique ordering field created in the join table will be a big and usefull improvement. Thank a lot for your beautiful work. Comment by Thomas Tourlourat - Armetiz [ 29/Feb/12 ] In my point of view, a collection can be order in a single way only. If you want to add more than one order between User & Group, it's a new collection, a new relation. Like : User.memberOf() : Group[] Group.members() : User[] Group.importantMembers() : User[] And it's your role to keep a consistency between members & importantMembers array. Because ManyToMany join table is the reflection of a state of an ArrayCollection. It's not a usefull feature to be able to store all of the state of an ArrayCollection, even the order of this Array. It's just a normal feature that is really missing Thomas. Comment by Nicolas [ 29/Feb/12 ] I don't think: If you have three collection, you duplicate one relation 3 times and it's easy in consequence to lost the data integrity and unicity. By example : Thomas have rank 10 in Admin Thomas think the admin group has importance noted 3 on all of his groups. If a responsable of admin group decide to delete Thomas from it. Thomas, in his ordered list of groups, think always to be in group admin. So in my idea, the many to many relation isn't just an array collection, but should be an virtual entity. In UML or in Merise method this is a common problem to have a parametized relation. I think an orm should just implement this. Comment by Thomas Tourlourat - Armetiz [ 29/Feb/12 ] Hum, I agree with you.. In a SQL Schema, it's a good choice to add many fields in a ManyToMany join table to description "order". Comment by Thomas Tourlourat - Armetiz [ 07/Mar/12 ] I just want to add a piece of Doctrine ORM Document : "When working with collections, keep in mind that a Collection is essentially an ordered map (just like a PHP array). That is why the remove operation accepts an index/key. removeElement is a separate method that has O ( n) complexity using array_search, where n is the size of the map." Comment by Thomas Tourlourat - Armetiz [ 23/Mar/12 ] Hi there, After several discussions. on IRC, I have changed my point of view. Doctrine Documentation says : "When working with collections, keep in mind that a Collection is essentially an ordered map (just like a PHP array)". So, I think that Doctrine have to be able to store or not the order of a Collection. By adding a new field on the Joined table to store the position of each elements. But I not agree with @Nicolas. Because in his case, he's talking about Association Class : http://etutorials.org/Programming/UML/Chapter+6.+Class+Diagrams+Advanced+Concepts/Association+Class/ Because he's talking of a business logic, he's talking of a dedicated Entity class. What do you think about it ? Thomas; Comment by Thomas Tourlourat - Armetiz [ 31/Aug/12 ] Any news ? Comment by Matthieu Napoli [ 16/Oct/12 ] Hi, any news on this? If I may add any info to this feature request, maybe something like JPA/Hibernate could be a good start? The idea in Hibernate is that you persist the order of the list in an extra column. This column is not a field of the entity however.

### [DDC-1219] Remove dependancy on Collection interface in Domain Objects Created: 21/Jun/11  Updated: 04/Jul/11

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

 Type: Improvement Priority: Major Reporter: André R. Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None

 Description
 Short: This issue is all about being able to use doctrine with naked domain objects without any use of doctrine classes. I 'm not talking about PersistentCollection here, fully aware of that being tied into Doctrine, but those are injected, this is all about code dependency on ArrayCollection. Seems like some of the UnitOfWork code is cable of handling other types of arrays, like:  // If $actualData[$name] is not a Collection then use an ArrayCollection. if ( ! $actualData[$name] instanceof Collection) { $actualData[$name] = new ArrayCollection($actualData[$name]); }  But in __cascade* functions this is not the case in all but two:  if ($relatedEntities instanceof Collection) { if ($relatedEntities instanceof PersistentCollection) { // Unwrap so that foreach() does not initialize  2 however have:  if (($relatedEntities instanceof Collection || is_array($relatedEntities))) { if ($relatedEntities instanceof PersistentCollection) { // Unwrap so that foreach() does not initialize  Would it be an idea to do "instanceof Traversable" instead of " instanceof Collection"?  Comments  Comment by André R. [ 21/Jun/11 ] Note: If the fist code block is always performed before the last 2 blocks then there is no issue here, just a need to make it more clear in Doc that this is possible but that you should not rely custom implementation as PersistentCollection will be injected when loaded from db. ### [DDC-1200] Derived Id Generator Created: 09/Jun/11 Updated: 09/Nov/11 Status: Open Project: Doctrine 2 - ORM Component/s: ORM Affects Version/s: Git Master Fix Version/s: 2.x Security Level: All  Type: Improvement Priority: Major Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 3 Labels: None Issue Links:  Duplicate is duplicated by DDC-1315 ORM\Id\AssignedGenerator doesn't work... Resolved  Description  For usage with the foreign key as primary key features described in DDC-117 a derived id generator would be tons of useful. It is essentially a post generate id generator (sort of late pre insert though) assigned generator.  Comments  Comment by Daniel Lima [ 09/Nov/11 ] When this will be fixed? I think this is related to http://groups.google.com/group/doctrine-user/browse_thread/thread/7e1cfa9c4c99af31 ### [DDC-93] It would be nice if we could have support for ValueObjects Created: 01/Nov/09 Updated: 23/Nov/13 Status: Open Project: Doctrine 2 - ORM Component/s: ORM Affects Version/s: None Fix Version/s: 2.x Security Level: All  Type: New Feature Priority: Major Reporter: Avi Block Assignee: Guilherme Blanco Resolution: Unresolved Votes: 40 Labels: None Issue Links:  Duplicate is duplicated by DDC-648 Custom mapping types for multiple DB ... Resolved Reference is referenced by DDC-2374 [GH-634] [WIP] Value objects Open  Description class User { /** * @Column(type="string") */ private$address;

/**
* @Column(type="string")
*/
private $city; /** * @Column(type="string") */ private$state;
}


We could have:

class User {
/**
*/

### [DDC-838] SchemaTool - ignores the attribute uniq in relations Created: 13/Oct/10  Updated: 29/Oct/10

Status: Open
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: 2.0-BETA4
Fix Version/s: 2.x
Security Level: All

 Type: Improvement Priority: Minor Reporter: gektor Assignee: Roman S. Borschel Resolution: Unresolved Votes: 0 Labels: None Environment: Ubuntu, PHP 5.3.2, MySQL

 Description
 Mapper   SQL CREATE TABLE test (id INT AUTO_INCREMENT NOT NULL, users_id INT DEFAULT NULL, blabla TINYINT(1) NOT NULL, UNIQUE INDEX test_users_id_uniq (users_id), PRIMARY KEY(id)) ENGINE = InnoDB; ALTER TABLE test ADD FOREIGN KEY (users_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE;  Actual: UNIQUE INDEX test_users_id_uniq (users_id) Expected: INDEX test_users_id (users_id)

 Comment by Benjamin Eberlei [ 14/Oct/10 ] Verified, i just don't understand why you are using a one-to-one relation and then "deactivate" the database constraint for this. You could easily use Many-To-One Comment by gektor [ 14/Oct/10 ] You are right. It's not a bug, it's feature. Comment by Benjamin Eberlei [ 29/Oct/10 ] This might still be a good improvement to allow the flexibility, but its not a bug. Updating to "Minor Improvmenet for 2.x"

### [DDC-1373] Map file with specific class Created: 13/Sep/11  Updated: 14/Feb/12

Status: Open
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: 2.1.1
Fix Version/s: 2.x
Security Level: All

 Type: Improvement Priority: Minor Reporter: Thomas Tourlourat - Armetiz Assignee: Fabio B. Silva Resolution: Unresolved Votes: 0 Labels: None Environment: Debian LAMP - PHP5.3 - Apache 2

 Description
 Hi there, AbsractFileDriver is using the filename to know the managed class. It's a cool feature because it's allow loading on-demand. The problem is, that the filename must be the name of the Class. It should be great to be able to manually map XML/YAML File description to a Class, like : $drivers->addMappingFile ( array ( "filename" => "class", "filename2" => "class2") ); This feature is simple to implement, just add a new array inside AbsractFileDriver to know the mapping. When using the current method with addPaths, parse the folder to get traditional XML/YAML file where filename corresponding to classname and add it to the mapping array. AbsractFileDriver->getAllClassNames () just return value of mapping array. The mapping array is store inside cache. With this new feature, it allow developers to create a pretty folder that contains entities mapping. Armetiz.  Comments  Comment by Guilherme Blanco [ 20/Dec/11 ] Updating fix version ### [DDC-17] Ability to skip the operation from a pre-operation event handler Created: 20/Sep/09 Updated: 26/Aug/10 Status: Open Project: Doctrine 2 - ORM Component/s: ORM Affects Version/s: None Fix Version/s: 2.x Security Level: All  Type: New Feature Priority: Minor Reporter: Ismo Toijala Assignee: Roman S. Borschel Resolution: Unresolved Votes: 0 Labels: None  Description  In Doctrine 1.1 it is possible to skip the operation in the event handlers in Doctrine_Record_Listener using Doctrine_Event::skipOperation. This no longer seems to be possible in Doctrine 2.0 Alpha 1, for example when handling a preRemove event to implement soft-delete behaviour. Perhaps a method could be added to \Doctrine\Common\EventArgs\LifecycleEventArgs to skip the operation, at least before the operation. Without this implementing soft-delete would require the user to update deleted_at and deleted_by himself and then save the record. It could no longer be done automatically when removing a record because the record is then removed.  Comments  Comment by Roman S. Borschel [ 20/Sep/09 ] The problem is, full support for soft-delete throughout the system is not feasible and very fragile. Simple soft-delete through skipping the delete operation is the easiest part. Then you will probably want to modify all DQL queries so that they adhere to it automatically and then there will always be still queries that do NOT go through DQL, like even internal lazy-load queries or native queries or others, which would need to be modified also. To sum it up, implementing soft-delete "inside" doctrine is absolutely not worth the effort and imho a bad idea and I'm certainly not willing to make lots of adjustments to the core that have a negative impact on performance just to make this soft-delete possible. I really recommend handling "soft" deletes yourself, the normal way, by simply abstracting entity retrieval and persistence through a DAO/repository layer. As a nice side-effect you get less magic and it still works when you swap out doctrine for another persistence provider. I am willing to add support for skipping deletes and maybe some other operations through events but I'm not willing to go any further, as explained above. ### [DDC-547] Consider allowing custom PersistentCollection implementations Created: 27/Apr/10 Updated: 24/Dec/10 Status: Open Project: Doctrine 2 - ORM Component/s: ORM Affects Version/s: 2.0-BETA1 Fix Version/s: 2.x Security Level: All  Type: New Feature Priority: Minor Reporter: Roman S. Borschel Assignee: Roman S. Borschel Resolution: Unresolved Votes: 6 Labels: None  Description  We should consider allowing the configuration of custom PersistentCollection implementations on a per-association basis. This could allow users to craft optimized (SQL) behavior for for some of their collections to improve performance without changing the domain model code. For this, PersistentCollection needs to be designed for inheritance.  Comments  Comment by Roman S. Borschel [ 26/Aug/10 ] Rescheduled for 2.1. Might be 2.x. Comment by Benjamin Eberlei [ 24/Dec/10 ] Reschedule for 2.x ### [DDC-445] Evaluate possible ways in which stored procedures can be used Created: 19/Mar/10 Updated: 24/Dec/10 Status: Open Project: Doctrine 2 - ORM Component/s: None Affects Version/s: None Fix Version/s: 2.x Security Level: All  Type: Improvement Priority: Minor Reporter: Roman S. Borschel Assignee: Roman S. Borschel Resolution: Unresolved Votes: 1 Labels: None Issue Links:  Reference relates to DDC-391 Allow to specifiy custom Entity and C... In Progress  Description  We should evaluate the current situation of stored procedure support as well as where we want to go with it / how far we want to support it, if at all.  Comments  Comment by Benjamin Eberlei [ 19/Mar/10 ] I think this relates to the usage of Custom Persisters ### [DDC-4] Implement support for Concrete Table Inheritance Created: 09/Sep/09 Updated: 24/Dec/10 Status: Open Project: Doctrine 2 - ORM Component/s: ORM Affects Version/s: 2.1 Fix Version/s: 2.x Security Level: All  Type: Improvement Priority: Minor Reporter: Roman S. Borschel Assignee: Roman S. Borschel Resolution: Unresolved Votes: 0 Labels: None  Description  A first implementation could probably live without support for polymorphic queries (requires SQL UNIONs to be generated). Add the notion of read-only entities (DDC-209) ### [DDC-691] doctrine.readOnly query hint Created: 15/Jul/10 Updated: 31/May/12 Status: Open Project: Doctrine 2 - ORM Component/s: DQL, ORM Affects Version/s: None Fix Version/s: 2.x Security Level: All  Type: Sub-task Priority: Minor Reporter: Roman S. Borschel Assignee: Roman S. Borschel Resolution: Unresolved Votes: 5 Labels: None  Description  Setting such a query hint to TRUE should result in all entities being retrieved by that query to be read-only for the purposes of change-tracking. Note that the entities themselves need not necessarily be read-only in general. This feature is a flush performance tweak that can be used to query for objects but not let the returned objects run through change-tracking on flush. Any other managed objects are tracked as usual so you can do a read-only query for 100 entities and persist a new entity in the same unit of work with optimal flushing performance.  Comments  Comment by Konstantin [ 26/Dec/11 ] Any news? Why query hint? What about temporary switching like fetch mode changing via query object? Comment by Gigi Largeanus [ 31/May/12 ] Any news on this? I think this is a must have feature. Thanks for all your work. ### [DDC-1370] preInsert, postInsert, prePersist, postPersist, preUpdate, postUpdate code and documentation of events Created: 09/Sep/11 Updated: 17/Oct/13 Status: Awaiting Feedback Project: Doctrine 2 - ORM Component/s: ORM Affects Version/s: None Fix Version/s: 2.x Security Level: All  Type: Improvement Priority: Minor Reporter: Guilherme Blanco Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 1 Labels: None  Description  Currently we have a set of Lifecycle events, but they seem to be misleading both in actual implementation and documentation. One good example is prePersist and postPersist, which is only fired when you're creating new entities. It should be renamed to preInsert and postInsert. As of preUpdate and postUpdate, they seem quite valid. But if we rename prePersist and postPersist to (pre|post)Insert, we may have a situation where you wanna cover both insert and update. For this, (pre|post)Persist should be reinstated, but acting differently from what it does currently.  Comments  Comment by Rafael Dohms [ 09/Sep/11 ] Also, documentation for post* methods is broken at the website: "Changes in here are not relevant to the persistence in the database, but you can use this events to" It cuts off in mid-sentence. Comment by Guilherme Blanco [ 09/Dec/11 ] RDohms, this paragraph was already sorted out. The actual ticket is still valid here. Comment by Guilherme Blanco [ 20/Dec/11 ] Updating fix version ### [DDC-391] Allow to specifiy custom Entity and Collection Persister classes Created: 06/Mar/10 Updated: 08/Sep/13 Status: In Progress Project: Doctrine 2 - ORM Component/s: ORM Affects Version/s: 2.0-ALPHA4 Fix Version/s: 2.x Security Level: All  Type: New Feature Priority: Minor Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 6 Labels: None Issue Links:  Reference is referenced by DDC-2637 [GH-769] Add Custom Persisters Open is referenced by DDC-445 Evaluate possible ways in which store... Open is referenced by DDC-699 ProxyFactory: allow to overwrite$_pr... Resolved

 Description
 It should be allowed to overwrite the default persisters for collections and entities. This should go along the lines of Hibernate which allows to set the custom implementations like: XML:   Annotation /** * @Entity(persister="persisterClass") * @OneToMany(persister="persisterClass") */ 

 Comment by Roman S. Borschel [ 19/May/10 ] Rescheduling for beta3. Comment by Roman S. Borschel [ 07/Jul/10 ] Pushing back to beta4. Comment by Roman S. Borschel [ 12/Jul/10 ] Moved to 2.1 due to lack of time for any larger new features for 2.0. Comment by Benjamin Eberlei [ 13/Oct/10 ] implemented this in a feature branch for now, it really doesnt touch any other runtime code so maybe we can still merge this before RC1 http://github.com/doctrine/doctrine2/tree/OverridePersisters Comment by Gediminas Morkevicius [ 25/Feb/11 ] Is this forgotten? you should merge it since it does not affect any other parts of ORM, this is a great feature Comment by Benjamin Eberlei [ 26/Feb/11 ] This has not been forgotten, but the Persister is due for a heavy refactoring for 2.2 probably, when we will make it use the SQL Query object that we are working on. So I cannot merge this, because the API will probably break big time. Comment by Jonas Wouters [ 16/Mar/11 ] Does that mean we will not see this feature before 2.2? Comment by Benjamin Eberlei [ 16/Mar/11 ] Yes, that is correct. I dont want to add it as experimental/undocumented feature because people will take it for granted and make us responsible for possible bc breaks. I will update the target version accordingly. Sorry for disappointing you, but this feature is fundamentally important at the core of the library. That means we have to get it right and not rush into it. Comment by Gediminas Morkevicius [ 17/Mar/11 ] Just as I thought that first you will want to make a query builder object for all persisters. since now they use plain sql. Thanks for all your work on this Comment by Adam Brodziak [ 11/Jan/12 ] I might be mistaken, but AFAICS mentioned Persister heavy refactoring did not made through to 2.2 version. Is there any plan to have it in 2.3 or at any later stage? Comment by Guilherme Blanco [ 13/Jan/12 ] @Adam I refactored all Persisters optimizing their code, but I could not complete the move from SQL string generation to Doctrine\DBAL\Query. We missed it, yes. I may reschedule for 2.3 Comment by Thomas Rothe [ 05/Sep/12 ] Why is it still missing in 2.3? I would require this for an extension that uses its own overridden entity persister and using a custom persister is the solution that you guys recomend for not overriding the entity manager. Comment by sebastiaan stok [ 23/Sep/12 ] Any change seeing this soon? I really need this for a security feature. What is making this so hard? just adding an setEntityPersister($entityName,$object) should do the trick. I don't need any fancy stuff, just a way to limit the fields in the SELECT list. Edit: OK, I'm shot I CAN NOT overwrite the entity manager as the UnitOfWork is private! Got any other idea? Comment by Stefan Kögel [ 24/Sep/12 ] Any chance you could add this quickly? I need this feature urgently to complete an extension using a custom persister. Thanks in advance. Comment by Lennart Weijl [ 09/Jul/13 ] What's the status on this issue?

### [DDC-2133] Issue with Query::iterate and query mixed results Created: 09/Nov/12  Updated: 01/May/13

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

 Type: Bug Priority: Major Reporter: Oleg Namaka Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None

 Duplicate is duplicated by DDC-1314 DQL permits partial select using SQL Resolved

 Description
 Consider this code: $dql = " SELECT Page, Product.name FROM Dlayer\\Entity\\Page Page INNER JOIN Page.Product Product ";$q = ($em->createQuery($dql)); foreach ($q->iterate() as$entry) { $page =$entry[0][0]; $name =$entry[0]['name']; }  This results with undefined index: 'name' for the second entry. First result keys are (notice just one array element with index 0): 0 array(2) { [0] => int(0) [1] => string(4) "name" }  but all others are different (notice two array elements with index 0 and the other one that is incrementing): the second one: 0 array(1) { [0] => int(0) } 1 array(1) { [0] => string(4) "name" } the third one: 0 array(1) { [0] => int(0) } 2 array(1) { [0] => string(4) "name" }  What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method?

 Comment by Benjamin Eberlei [ 12/Nov/12 ] This is a known issue that we don't have found a BC fix for and as I understand Guilherme Blanco requires considerable refactoring.

### [DDC-2316] [GH-588] ClassMetadataInfo: use reflection for creating new instance (on PHP >=5.4) Created: 23/Feb/13  Updated: 04/May/13

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

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

 Description
 This issue is created automatically through a Github pull request on behalf of Majkl578: Message: On PHP >=5.4, use proper way for instantiating classes without invoking constructor.

 Comment by Benjamin Eberlei [ 04/May/13 ] Scheduling this for 3.0, when we move to php 5.4 or higher requirement

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

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

 Type: Improvement Priority: Major Reporter: Enea Bette Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: onetomany, persister, unidirectional Environment: Debian Wheezy, Mysql 5.1, Apache2, PHP 5.4

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

 Comment by Enea Bette [ 16/Dec/12 ] A little up... for inspiration from JPA http://en.wikibooks.org/wiki/Java_Persistence/OneToMany#Undirectional_OneToMany.2C_No_Inverse_ManyToOne.2C_No_Join_Table_.28JPA_2.0_ONLY.29

### [DDC-1963] Remove by-ref access to changeset in lifecycle event args Created: 31/Jul/12  Updated: 31/Jul/12

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

 Type: Improvement Priority: Major Reporter: Marco Pivetta Assignee: Marco Pivetta Resolution: Unresolved Votes: 0 Labels: None

 Description
 UoW currently passes computed changesets to lifecycle event args byref. This has to be changed to force users to use UoW public API to modify changesets instead.

### [DDC-2061] Matching Criteria on a PersistentCollection only works on OneToMany associations Created: 08/Oct/12  Updated: 08/Oct/12

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

 Type: Improvement Priority: Major Reporter: Terje Bråten Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 3 Labels: criteria, matching

 Description
 What is needed to make it also work for ManyToMany associations? May be a better fallback would be do an ArrayCollection->matching() instead of just giving a runtime exception? Is this something that is difficult to implement?

### [DDC-2387] convert-mapping not working correctly with composite primary keys/foreign keys in 2.4.0-RC1 Created: 03/Apr/13  Updated: 01/Jul/13

Status: Awaiting Feedback
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: 2.3, 2.3.1, 2.3.2, 2.3.3, 2.3.4
Fix Version/s: 2.3.4
Security Level: All

 Type: Bug Priority: Major Reporter: Nicholas Van Dusen Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 4 Labels: None Environment: Symfony 2.2.0, MySQL 5.1

 Description
 (Apologies if this is somehow a Symfony-specific issue) I updated my application via Composer yesterday, and received Doctrine 2.4.0-RC1. After this update, generating entities has been problematic under certain circumstances. Here is an example table in MySQL: CREATE TABLE user_email ( user_id int(10) unsigned NOT NULL COMMENT 'FK to user', email varchar(254) NOT NULL, email_datasource smallint(1) unsigned NOT NULL COMMENT 'FK to datasource_code', insert_date datetime NOT NULL, PRIMARY KEY (user_id,email,email_datasource), KEY FK_UserEmail_DataSourceCode (email_datasource), CONSTRAINT FK_UserEmail_User FOREIGN KEY (user_id) REFERENCES user (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8  In Doctrine 2.3, the mapping works correctly, and you end up with a 3-part primary key, with a user property mapped to the User entity, and a datasourceCode property mapped to the DatasourceCode entity. All good. In 2.4, the following error is given: Single id is not allowed on composite primary key in entity UserEmail. Removing one of the foreign keys in the table (either to User or DatasourceCode) but keeping the primary key set to all 3 columns allows the mapping to work. But, if you then remove one of the columns from the primary key (say, email_datasource) it fails again.

 Comment by Benjamin Eberlei [ 04/Apr/13 ] Can you provide the full stack trace to the exception please? $e->getTraceAsString();  Comment by Nicholas Van Dusen [ 11/Apr/13 ] Benjamin, I'm not sure how to get the trace for you, since I'm running from inside the Symfony2 doctrine:mapping:import command line item. Comment by Christophe Coevoet [ 11/Apr/13 ] Use the --verbose option when running the command Comment by Nicholas Van Dusen [ 11/Apr/13 ] I was able to get a trace for you: #0 /var/www/html/voxrepublic/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php(1571): Doctrine\ORM\Mapping\MappingException::singleIdNotAllowedOnCompositePrimaryKey('UserEmail') #1 /var/www/html/voxrepublic/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(422): Doctrine\ORM\Mapping\ClassMetadataInfo->getSingleIdentifierFieldName() #2 /var/www/html/voxrepublic/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(136): Doctrine\ORM\Mapping\ClassMetadataFactory->completeIdGeneratorMapping(Object(Doctrine\ORM\Mapping\ClassMetadata)) #3 /var/www/html/voxrepublic/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(302): Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata(Object(Doctrine\ORM\Mapping\ClassMetadata), NULL, false, Array) #4 /var/www/html/voxrepublic/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(212): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata('UserEmail') #5 /var/www/html/voxrepublic/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(112): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor('UserEmail') #6 /var/www/html/voxrepublic/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/ImportMappingDoctrineCommand.php(108): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata() #7 /var/www/html/voxrepublic/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php(240): Doctrine\Bundle\DoctrineBundle\Command\ImportMappingDoctrineCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #8 /var/www/html/voxrepublic/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #9 /var/www/html/voxrepublic/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(78): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #10 /var/www/html/voxrepublic/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(106): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #11 /var/www/html/voxrepublic/app/console(22): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput)) #12 {main}  Comment by Benjamin Eberlei [ 14/Apr/13 ] The problem is that Doctrine seems to detect that you only have on id field on this entity and then a new function of 2.4 throws this error. I will try to reproduce this with your table. Until then could you show me the var_dump() of the$class variable in Doctrine\ORM\ClassMetadataFactory#completeIdGeneratorMapping()? This would help very much already. Comment by Maximilian Beck [ 15/Apr/13 ] I have the same error when using "doctrine:mapping:import" CREATE TABLE IF NOT EXISTS dev_Recipe.step ( recipe_id INT NOT NULL , step_number INT NOT NULL , description TEXT NULL , timer INT NULL , image VARCHAR(100) NULL , PRIMARY KEY (recipe_id, step_number) , INDEX recipe_id_idx (recipe_id ASC) , INDEX step_number (step_number ASC) , CONSTRAINT step_recipe_id FOREIGN KEY (recipe_id ) REFERENCES dev_Recipe.recipe (recipe_id ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; Exception trace: () at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\MappingException.php:258 Doctrine\ORM\Mapping\MappingException::singleIdNotAllowedOnCompositePrimaryKey() at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataInfo.php:1571 Doctrine\ORM\Mapping\ClassMetadataInfo->getSingleIdentifierFieldName() at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataFactory.php:422 Doctrine\ORM\Mapping\ClassMetadataFactory->completeIdGeneratorMapping() at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataFactory.php:136 Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata() at \htdocs\SF2\vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php:302 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at \htdocs\SF2\vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php:212 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at \htdocs\SF2\vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php:112 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata() at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand.php:126 Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand->execute() at \htdocs\SF2\vendor\doctrine\doctrine-bundle\Doctrine\Bundle\DoctrineBundle\Command\Proxy\ConvertMappingDoctrineCommand.php:59 Doctrine\Bundle\DoctrineBundle\Command\Proxy\ConvertMappingDoctrineCommand->execute() at \htdocs\SF2\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:240 Symfony\Component\Console\Command\Command->run() at \htdocs\SF2\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:193 Symfony\Component\Console\Application->doRun() at \htdocs\SF2\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:78 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at \htdocs\SF2\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:106 Symfony\Component\Console\Application->run() at \htdocs\SF2\app\console:22 "var_dump($class);" returns: object(Doctrine\ORM\Mapping\ClassMetadata)#470 (36) { ["name"]=> string(10) "Ingredient" ["namespace"]=> string(0) "" ["rootEntityName"]=> string(10) "Ingredient" ["customGeneratorDefinition"]=> NULL ["customRepositoryClassName"]=> NULL ["isMappedSuperclass"]=> bool(false) ["parentClasses"]=> array(0) { } ["subClasses"]=> array(0) { } ["namedQueries"]=> array(0) { } ["namedNativeQueries"]=> array(0) { } ["sqlResultSetMappings"]=> array(0) { } ["identifier"]=> array(1) { [0]=> string(12) "ingredientId" } ["inheritanceType"]=> int(1) ["generatorType"]=> int(1) ["fieldMappings"]=> array(4) { ["ingredientId"]=> array(6) { ["id"]=> bool(true) ["fieldName"]=> string(12) "ingredientId" ["columnName"]=> string(13) "ingredient_id" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(false) } ["name"]=> array(6) { ["fieldName"]=> string(4) "name" ["columnName"]=> string(4) "name" ["type"]=> string(6) "string" ["length"]=> int(45) ["fixed"]=> bool(false) ["nullable"]=> bool(false) } ["color"]=> array(5) { ["fieldName"]=> string(5) "color" ["columnName"]=> string(5) "color" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(false) } ["img"]=> array(6) { ["fieldName"]=> string(3) "img" ["columnName"]=> string(3) "img" ["type"]=> string(6) "string" ["length"]=> int(45) ["fixed"]=> bool(false) ["nullable"]=> bool(true) } } ["fieldNames"]=> array(4) { ["ingredient_id"]=> string(12) "ingredientId" ["name"]=> string(4) "name" ["color"]=> string(5) "color" ["img"]=> string(3) "img" } ["columnNames"]=> array(4) { ["ingredientId"]=> string(13) "ingredient_id" ["name"]=> string(4) "name" ["color"]=> string(5) "color" ["img"]=> string(3) "img" } ["discriminatorValue"]=> NULL ["discriminatorMap"]=> array(0) { } ["discriminatorColumn"]=> NULL ["table"]=> array(1) { ["name"]=> string(10) "ingredient" } ["lifecycleCallbacks"]=> array(0) { } ["associationMappings"]=> array(1) { ["ingredientCategory"]=> array(15) { ["fieldName"]=> string(18) "ingredientCategory" ["targetEntity"]=> string(18) "IngredientCategory" ["mappedBy"]=> string(10) "ingredient" ["type"]=> int(8) ["inversedBy"]=> NULL ["isOwningSide"]=> bool(false) ["sourceEntity"]=> string(10) "Ingredient" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["orphanRemoval"]=> bool(false) } } ["isIdentifierComposite"]=> bool(false) ["containsForeignIdentifier"]=> bool(false) ["idGenerator"]=> NULL ["sequenceGeneratorDefinition"]=> NULL ["tableGeneratorDefinition"]=> NULL ["changeTrackingPolicy"]=> int(1) ["isVersioned"]=> NULL ["versionField"]=> NULL ["reflClass"]=> NULL ["isReadOnly"]=> bool(false) ["namingStrategy":protected]=> object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) { } ["reflFields"]=> array(0) { } ["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=> NULL } object(Doctrine\ORM\Mapping\ClassMetadata)#472 (36) { ["name"]=> string(18) "IngredientCategory" ["namespace"]=> string(0) "" ["rootEntityName"]=> string(18) "IngredientCategory" ["customGeneratorDefinition"]=> NULL ["customRepositoryClassName"]=> NULL ["isMappedSuperclass"]=> bool(false) ["parentClasses"]=> array(0) { } ["subClasses"]=> array(0) { } ["namedQueries"]=> array(0) { } ["namedNativeQueries"]=> array(0) { } ["sqlResultSetMappings"]=> array(0) { } ["identifier"]=> array(1) { [0]=> string(2) "id" } ["inheritanceType"]=> int(1) ["generatorType"]=> int(1) ["fieldMappings"]=> array(3) { ["id"]=> array(6) { ["id"]=> bool(true) ["fieldName"]=> string(2) "id" ["columnName"]=> string(2) "id" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(false) } ["name"]=> array(6) { ["fieldName"]=> string(4) "name" ["columnName"]=> string(4) "name" ["type"]=> string(6) "string" ["length"]=> int(255) ["fixed"]=> bool(false) ["nullable"]=> bool(false) } ["description"]=> array(4) { ["fieldName"]=> string(11) "description" ["columnName"]=> string(11) "description" ["type"]=> string(4) "text" ["nullable"]=> bool(true) } } ["fieldNames"]=> array(3) { ["id"]=> string(2) "id" ["name"]=> string(4) "name" ["description"]=> string(11) "description" } ["columnNames"]=> array(3) { ["id"]=> string(2) "id" ["name"]=> string(4) "name" ["description"]=> string(11) "description" } ["discriminatorValue"]=> NULL ["discriminatorMap"]=> array(0) { } ["discriminatorColumn"]=> NULL ["table"]=> array(1) { ["name"]=> string(19) "ingredient_category" } ["lifecycleCallbacks"]=> array(0) { } ["associationMappings"]=> array(2) { ["ingredient"]=> array(19) { ["fieldName"]=> string(10) "ingredient" ["targetEntity"]=> string(10) "Ingredient" ["inversedBy"]=> string(18) "ingredientCategory" ["joinTable"]=> array(3) { ["name"]=> string(30) "ingredient_category_ingredient" ["joinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(22) "ingredient_category_id" ["referencedColumnName"]=> string(2) "id" } } ["inverseJoinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(13) "ingredient_id" ["referencedColumnName"]=> string(13) "ingredient_id" } } } ["type"]=> int(8) ["mappedBy"]=> NULL ["isOwningSide"]=> bool(true) ["sourceEntity"]=> string(18) "IngredientCategory" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["joinTableColumns"]=> array(2) { [0]=> string(22) "ingredient_category_id" [1]=> string(13) "ingredient_id" } ["relationToSourceKeyColumns"]=> array(1) { ["ingredient_category_id"]=> string(2) "id" } ["relationToTargetKeyColumns"]=> array(1) { ["ingredient_id"]=> string(13) "ingredient_id" } ["orphanRemoval"]=> bool(false) } ["parent"]=> array(19) { ["fieldName"]=> string(6) "parent" ["targetEntity"]=> string(18) "IngredientCategory" ["joinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(9) "parent_id" ["referencedColumnName"]=> string(2) "id" } } ["type"]=> int(2) ["mappedBy"]=> NULL ["inversedBy"]=> NULL ["isOwningSide"]=> bool(true) ["sourceEntity"]=> string(18) "IngredientCategory" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["sourceToTargetKeyColumns"]=> array(1) { ["parent_id"]=> string(2) "id" } ["joinColumnFieldNames"]=> array(1) { ["parent_id"]=> string(9) "parent_id" } ["targetToSourceKeyColumns"]=> array(1) { ["id"]=> string(9) "parent_id" } ["orphanRemoval"]=> bool(false) } } ["isIdentifierComposite"]=> bool(false) ["containsForeignIdentifier"]=> bool(false) ["idGenerator"]=> NULL ["sequenceGeneratorDefinition"]=> NULL ["tableGeneratorDefinition"]=> NULL ["changeTrackingPolicy"]=> int(1) ["isVersioned"]=> NULL ["versionField"]=> NULL ["reflClass"]=> NULL ["isReadOnly"]=> bool(false) ["namingStrategy":protected]=> object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) { } ["reflFields"]=> array(0) { } ["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=> NULL } object(Doctrine\ORM\Mapping\ClassMetadata)#474 (36) { ["name"]=> string(6) "Recipe" ["namespace"]=> string(0) "" ["rootEntityName"]=> string(6) "Recipe" ["customGeneratorDefinition"]=> NULL ["customRepositoryClassName"]=> NULL ["isMappedSuperclass"]=> bool(false) ["parentClasses"]=> array(0) { } ["subClasses"]=> array(0) { } ["namedQueries"]=> array(0) { } ["namedNativeQueries"]=> array(0) { } ["sqlResultSetMappings"]=> array(0) { } ["identifier"]=> array(1) { [0]=> string(8) "recipeId" } ["inheritanceType"]=> int(1) ["generatorType"]=> int(1) ["fieldMappings"]=> array(3) { ["recipeId"]=> array(6) { ["id"]=> bool(true) ["fieldName"]=> string(8) "recipeId" ["columnName"]=> string(9) "recipe_id" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(false) } ["name"]=> array(6) { ["fieldName"]=> string(4) "name" ["columnName"]=> string(4) "name" ["type"]=> string(6) "string" ["length"]=> int(255) ["fixed"]=> bool(false) ["nullable"]=> bool(false) } ["description"]=> array(4) { ["fieldName"]=> string(11) "description" ["columnName"]=> string(11) "description" ["type"]=> string(4) "text" ["nullable"]=> bool(true) } } ["fieldNames"]=> array(3) { ["recipe_id"]=> string(8) "recipeId" ["name"]=> string(4) "name" ["description"]=> string(11) "description" } ["columnNames"]=> array(3) { ["recipeId"]=> string(9) "recipe_id" ["name"]=> string(4) "name" ["description"]=> string(11) "description" } ["discriminatorValue"]=> NULL ["discriminatorMap"]=> array(0) { } ["discriminatorColumn"]=> NULL ["table"]=> array(1) { ["name"]=> string(6) "recipe" } ["lifecycleCallbacks"]=> array(0) { } ["associationMappings"]=> array(2) { ["recipeCategory"]=> array(15) { ["fieldName"]=> string(14) "recipeCategory" ["targetEntity"]=> string(14) "RecipeCategory" ["mappedBy"]=> string(6) "recipe" ["type"]=> int(8) ["inversedBy"]=> NULL ["isOwningSide"]=> bool(false) ["sourceEntity"]=> string(6) "Recipe" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["orphanRemoval"]=> bool(false) } ["users"]=> array(19) { ["fieldName"]=> string(5) "users" ["targetEntity"]=> string(5) "Users" ["inversedBy"]=> string(12) "recipeRecipe" ["joinTable"]=> array(3) { ["name"]=> string(13) "users_recipes" ["joinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(16) "recipe_recipe_id" ["referencedColumnName"]=> string(9) "recipe_id" } } ["inverseJoinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(8) "users_id" ["referencedColumnName"]=> string(2) "id" } } } ["type"]=> int(8) ["mappedBy"]=> NULL ["isOwningSide"]=> bool(true) ["sourceEntity"]=> string(6) "Recipe" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["joinTableColumns"]=> array(2) { [0]=> string(16) "recipe_recipe_id" [1]=> string(8) "users_id" } ["relationToSourceKeyColumns"]=> array(1) { ["recipe_recipe_id"]=> string(9) "recipe_id" } ["relationToTargetKeyColumns"]=> array(1) { ["users_id"]=> string(2) "id" } ["orphanRemoval"]=> bool(false) } } ["isIdentifierComposite"]=> bool(false) ["containsForeignIdentifier"]=> bool(false) ["idGenerator"]=> NULL ["sequenceGeneratorDefinition"]=> NULL ["tableGeneratorDefinition"]=> NULL ["changeTrackingPolicy"]=> int(1) ["isVersioned"]=> NULL ["versionField"]=> NULL ["reflClass"]=> NULL ["isReadOnly"]=> bool(false) ["namingStrategy":protected]=> object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) { } ["reflFields"]=> array(0) { } ["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=> NULL } object(Doctrine\ORM\Mapping\ClassMetadata)#476 (36) { ["name"]=> string(14) "RecipeCategory" ["namespace"]=> string(0) "" ["rootEntityName"]=> string(14) "RecipeCategory" ["customGeneratorDefinition"]=> NULL ["customRepositoryClassName"]=> NULL ["isMappedSuperclass"]=> bool(false) ["parentClasses"]=> array(0) { } ["subClasses"]=> array(0) { } ["namedQueries"]=> array(0) { } ["namedNativeQueries"]=> array(0) { } ["sqlResultSetMappings"]=> array(0) { } ["identifier"]=> array(1) { [0]=> string(2) "id" } ["inheritanceType"]=> int(1) ["generatorType"]=> int(1) ["fieldMappings"]=> array(3) { ["id"]=> array(6) { ["id"]=> bool(true) ["fieldName"]=> string(2) "id" ["columnName"]=> string(2) "id" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(false) } ["name"]=> array(6) { ["fieldName"]=> string(4) "name" ["columnName"]=> string(4) "name" ["type"]=> string(6) "string" ["length"]=> int(45) ["fixed"]=> bool(false) ["nullable"]=> bool(false) } ["description"]=> array(6) { ["fieldName"]=> string(11) "description" ["columnName"]=> string(11) "description" ["type"]=> string(6) "string" ["length"]=> int(45) ["fixed"]=> bool(false) ["nullable"]=> bool(true) } } ["fieldNames"]=> array(3) { ["id"]=> string(2) "id" ["name"]=> string(4) "name" ["description"]=> string(11) "description" } ["columnNames"]=> array(3) { ["id"]=> string(2) "id" ["name"]=> string(4) "name" ["description"]=> string(11) "description" } ["discriminatorValue"]=> NULL ["discriminatorMap"]=> array(0) { } ["discriminatorColumn"]=> NULL ["table"]=> array(1) { ["name"]=> string(15) "recipe_category" } ["lifecycleCallbacks"]=> array(0) { } ["associationMappings"]=> array(2) { ["recipe"]=> array(19) { ["fieldName"]=> string(6) "recipe" ["targetEntity"]=> string(6) "Recipe" ["inversedBy"]=> string(14) "recipeCategory" ["joinTable"]=> array(3) { ["name"]=> string(22) "recipe_category_recipe" ["joinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(18) "recipe_category_id" ["referencedColumnName"]=> string(2) "id" } } ["inverseJoinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(9) "recipe_id" ["referencedColumnName"]=> string(9) "recipe_id" } } } ["type"]=> int(8) ["mappedBy"]=> NULL ["isOwningSide"]=> bool(true) ["sourceEntity"]=> string(14) "RecipeCategory" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["joinTableColumns"]=> array(2) { [0]=> string(18) "recipe_category_id" [1]=> string(9) "recipe_id" } ["relationToSourceKeyColumns"]=> array(1) { ["recipe_category_id"]=> string(2) "id" } ["relationToTargetKeyColumns"]=> array(1) { ["recipe_id"]=> string(9) "recipe_id" } ["orphanRemoval"]=> bool(false) } ["parent"]=> array(19) { ["fieldName"]=> string(6) "parent" ["targetEntity"]=> string(14) "RecipeCategory" ["joinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(9) "parent_id" ["referencedColumnName"]=> string(2) "id" } } ["type"]=> int(2) ["mappedBy"]=> NULL ["inversedBy"]=> NULL ["isOwningSide"]=> bool(true) ["sourceEntity"]=> string(14) "RecipeCategory" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["sourceToTargetKeyColumns"]=> array(1) { ["parent_id"]=> string(2) "id" } ["joinColumnFieldNames"]=> array(1) { ["parent_id"]=> string(9) "parent_id" } ["targetToSourceKeyColumns"]=> array(1) { ["id"]=> string(9) "parent_id" } ["orphanRemoval"]=> bool(false) } } ["isIdentifierComposite"]=> bool(false) ["containsForeignIdentifier"]=> bool(false) ["idGenerator"]=> NULL ["sequenceGeneratorDefinition"]=> NULL ["tableGeneratorDefinition"]=> NULL ["changeTrackingPolicy"]=> int(1) ["isVersioned"]=> NULL ["versionField"]=> NULL ["reflClass"]=> NULL ["isReadOnly"]=> bool(false) ["namingStrategy":protected]=> object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) { } ["reflFields"]=> array(0) { } ["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=> NULL } object(Doctrine\ORM\Mapping\ClassMetadata)#478 (36) { ["name"]=> string(4) "Step" ["namespace"]=> string(0) "" ["rootEntityName"]=> string(4) "Step" ["customGeneratorDefinition"]=> NULL ["customRepositoryClassName"]=> NULL ["isMappedSuperclass"]=> bool(false) ["parentClasses"]=> array(0) { } ["subClasses"]=> array(0) { } ["namedQueries"]=> array(0) { } ["namedNativeQueries"]=> array(0) { } ["sqlResultSetMappings"]=> array(0) { } ["identifier"]=> array(2) { [0]=> string(10) "stepNumber" [1]=> string(6) "recipe" } ["inheritanceType"]=> int(1) ["generatorType"]=> int(1) ["fieldMappings"]=> array(4) { ["stepNumber"]=> array(6) { ["id"]=> bool(true) ["fieldName"]=> string(10) "stepNumber" ["columnName"]=> string(11) "step_number" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(false) } ["description"]=> array(4) { ["fieldName"]=> string(11) "description" ["columnName"]=> string(11) "description" ["type"]=> string(4) "text" ["nullable"]=> bool(true) } ["timer"]=> array(5) { ["fieldName"]=> string(5) "timer" ["columnName"]=> string(5) "timer" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(true) } ["image"]=> array(6) { ["fieldName"]=> string(5) "image" ["columnName"]=> string(5) "image" ["type"]=> string(6) "string" ["length"]=> int(100) ["fixed"]=> bool(false) ["nullable"]=> bool(true) } } ["fieldNames"]=> array(4) { ["step_number"]=> string(10) "stepNumber" ["description"]=> string(11) "description" ["timer"]=> string(5) "timer" ["image"]=> string(5) "image" } ["columnNames"]=> array(4) { ["stepNumber"]=> string(11) "step_number" ["description"]=> string(11) "description" ["timer"]=> string(5) "timer" ["image"]=> string(5) "image" } ["discriminatorValue"]=> NULL ["discriminatorMap"]=> array(0) { } ["discriminatorColumn"]=> NULL ["table"]=> array(1) { ["name"]=> string(4) "step" } ["lifecycleCallbacks"]=> array(0) { } ["associationMappings"]=> array(1) { ["recipe"]=> array(20) { ["fieldName"]=> string(6) "recipe" ["targetEntity"]=> string(6) "Recipe" ["id"]=> bool(true) ["joinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(9) "recipe_id" ["referencedColumnName"]=> string(9) "recipe_id" } } ["type"]=> int(1) ["mappedBy"]=> NULL ["inversedBy"]=> NULL ["isOwningSide"]=> bool(true) ["sourceEntity"]=> string(4) "Step" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["sourceToTargetKeyColumns"]=> array(1) { ["recipe_id"]=> string(9) "recipe_id" } ["joinColumnFieldNames"]=> array(1) { ["recipe_id"]=> string(9) "recipe_id" } ["targetToSourceKeyColumns"]=> array(1) { ["recipe_id"]=> string(9) "recipe_id" } ["orphanRemoval"]=> bool(false) } } ["isIdentifierComposite"]=> bool(true) ["containsForeignIdentifier"]=> bool(true) ["idGenerator"]=> NULL ["sequenceGeneratorDefinition"]=> NULL ["tableGeneratorDefinition"]=> NULL ["changeTrackingPolicy"]=> int(1) ["isVersioned"]=> NULL ["versionField"]=> NULL ["reflClass"]=> NULL ["isReadOnly"]=> bool(false) ["namingStrategy":protected]=> object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) { } ["reflFields"]=> array(0) { } ["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=> NULL } Comment by Benjamin Eberlei [ 09/May/13 ] Fixed and merged back to 2.3 Comment by Nicholas Van Dusen [ 29/May/13 ] I tested this again using 2.3.4 (the version which contains this fix) and it is still occurring. Attempting to import mapping for a table with 2 foreign keys in the primary key results in the error "Database does not have any mapping information." Adding a third column on the primary key "fixes" the issue. Currently our developers are being asked to add a fake third part to the key to work around the issue, then delete that key once they get into the entity class. This is a bit tedious and I'd love to see a fix! Comment by Nicholas Van Dusen [ 29/May/13 ] Issue still present in 2.3.4 and 2.4.0-RC1 Comment by Guillermo [ 11/Jun/13 ] The database engine I use is PostgreSQL. I'm having problems when mapping entities with composite primary keys in other tables. CREATE TABLE public.establecimiento ( id_establecimiento integer NOT NULL, establecimiento character varying(100) NOT NULL, CONSTRAINT pk_establecimiento PRIMARY KEY (id_establecimiento ) ) WITH ( OIDS=FALSE ); CREATE TABLE public.establecimiento_sec ( id_establecimiento_sec integer NOT NULL, id_establecimiento integer NOT NULL, det_seccion character varying(40) NOT NULL, plano character varying(100), sector_ingreso character varying(254), sponsor_imagen_sec character varying(96000), CONSTRAINT pk_establecimientos_sec PRIMARY KEY (id_establecimiento_sec , id_establecimiento ), CONSTRAINT fk_establec_reference_establec FOREIGN KEY (id_establecimiento) REFERENCES public.establecimiento (id_establecimiento) MATCH SIMPLE ON UPDATE RESTRICT ON DELETE RESTRICT ) WITH ( OIDS=TRUE ); CREATE TABLE public.establecimiento_sec_plano ( id_establecimiento_sec_plano integer NOT NULL, id_establecimiento_sec integer NOT NULL, id_establecimiento integer NOT NULL, det_plano character varying(512), cantidad integer NOT NULL, precio double precision, insert_charge double precision DEFAULT 0, descr character varying(254), CONSTRAINT pk_establecimiento_sec_plano PRIMARY KEY (id_establecimiento_sec_plano , id_establecimiento_sec , id_establecimiento ), CONSTRAINT fk_establecimiento_sec FOREIGN KEY (id_establecimiento, id_establecimiento_sec) REFERENCES public.establecimiento_sec (id_establecimiento, id_establecimiento_sec) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE ) WITH ( OIDS=FALSE ); Defining the entity establecimientoSecPlano,$establecimientoSec variable containing the keys $establecimiento and$id_establecimiento_sec //Entity/EstablecimientosSecPlano /** * @ORM\Id * @ORM\ManyToOne(targetEntity="Ticketway\PruebaBundle\Entity\EstablecimientosSec") * @ORM\JoinColumns( * @ORM\JoinColumn(name="id_establecimiento_sec", referencedColumnName="id_establecimiento_sec"), * @ORM\JoinColumn(name="id_establecimiento", referencedColumnName="id_establecimiento")) */ private $establecimientoSec; //Entity/EstablecimientosSec /** * @ORM\Id * @ORM\ManyToOne(targetEntity="Ticketway\PruebaBundle\Entity\Establecimientos") * @ORM\JoinColumn(name="id_establecimiento", referencedColumnName="id_establecimiento") */ private$establecimiento; When executing the command doctrine: mapping: import I get the following error [Doctrine\ORM\Mapping\MappingException] It is not possible to map entity 'EstablecimientoSec' with a composite primary key as part of the primary key of another entity 'EstablecimientoSecPlano#idEstablecimiento'. Comment by Sam Van der Borght [ 28/Jun/13 ] We are having the same problem as Guillermo. Any idea on how to fix this issue? Does anybody know why this problem occurs? I have been looking in the code but havent had much success. Comment by Diego Antunes [ 01/Jul/13 ] Doesn't work for me either, composite keys aren't working in 2.3.4 Can we get a fix for this?

### [DDC-2736] Error generating annotations of index in Entities Created: 11/Oct/13  Updated: 17/Oct/13

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

 Type: Bug Priority: Minor Reporter: Cesar Gutierrez Tineo Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None Environment: Ubuntu 12.04, PHP 5.3.10

 Attachments: bootstrap.php     Opportunities.php

 Description
 throw this error [Doctrine\Common\Annotations\AnnotationException] [Semantical Error] The annotation "@Doctrine\ORM\Mapping\index" in class CRM\Entity\Opportunities does not exist, or could not be auto-loaded.

 Comment by Marco Pivetta [ 17/Oct/13 ] Can you provide the entire generated file as an attachment? Comment by Cesar Gutierrez Tineo [ 17/Oct/13 ] Generated class. Comment by Cesar Gutierrez Tineo [ 17/Oct/13 ] Hi, Marco. Do I have to provide more files? Comment by Marco Pivetta [ 17/Oct/13 ] Cesar Gutierrez Tineo looks like the annotations for Index are lowercase (index) - what command did you issue to generate them? Comment by Cesar Gutierrez Tineo [ 17/Oct/13 ] i configured my bootstrap, and used " orm:generate-entities " in php bin/doctrine Comment by Marco Pivetta [ 17/Oct/13 ] Can you try using 2.4 for this? It looks OK in the EntityGenerator... Comment by Cesar Gutierrez Tineo [ 17/Oct/13 ] Ok, I'll try. I use 2.2.1.

### [DDC-2808] Notice: Undefined index: joinColumns in Doctrine/ORM/Persisters/BasicEntityPersister.php line 1527 with many-to-many relation and contains criteria Created: 21/Nov/13  Updated: 21/Nov/13

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

 Type: Bug Priority: Major Reporter: Alex WARrior Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None Environment: Symfony 2.3.8-DEV

 Description
 Field Annotation:  /** * @ORM\ManyToMany(targetEntity="Asset") * @ORM\JoinTable( * name="bookings_assets", * joinColumns={@ORM\JoinColumn(name="booking_id", referencedColumnName="id", onDelete="CASCADE", nullable=false)}, * inverseJoinColumns={@ORM\JoinColumn(name="asset_id", referencedColumnName="id", onDelete="CASCADE", nullable=false)} * ) */  Criteria definition:  $criteria = Criteria::create();$criteria ->where($criteria::expr()->contains('assets',$asset)) ;  Throws error when apply this criteria to not-loaded collection (via persistent collection). Do not throws any errors when works with ArrayCollection. The error is  Notice: Undefined index: joinColumns in Doctrine/ORM/Persisters/BasicEntityPersister.php line 1527  It seems that annotationMapptings array doesn't contains joinColumns in root, it contains this key under joinTable key. May be fix would be (line 1527) return $this->_getSQLTableAlias($className) . '.' . (isset($this->_class->associationMappings[$field]['joinColumns']) ? $this->_class->associationMappings[$field]['joinColumns'][0]['name'] : $this->_class->associationMappings[$field]['joinTable']['joinColumns'][0]['name']);  Update: After this fix I got the next error: Notice: Undefined index: CONTAINS in Doctrine/ORM/Persisters/BasicEntityPersister.php line 1490  Seems that you doesn't support contains method in this persister

### [DDC-2570] Doctrine CLI Tools - Clear All Cache Created: 24/Jul/13  Updated: 07/Sep/13

Status: Awaiting Feedback
Project: Doctrine 2 - ORM
Component/s: ORM, Tools
Affects Version/s: 2.3.4
Fix Version/s: 2.3.5, 2.5

 Type: Improvement Priority: Minor Reporter: Frederick Marcoux Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: Cli, cache, orm

 Description
 It would be nice to be able to clear all cache one shot instead of clearing them one after one... Like this: root$./doctrine orm:clear-cache:all Instead of: root$ ./doctrine orm:clear-cache:metadata root$./doctrine orm:clear-cache:result root$ ./doctrine orm:clear-cache:query

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

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

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

 Description

### [DDC-1738] Allow multiple Generators per class Created: 29/Mar/12  Updated: 07/Sep/13

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

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

 Description
 We should be able to support multiple generators per class. When doing partition per table, the partitioned column must be part of PK, which may enter in our limitation. Currently we only support 1 generator per class.

### [DDC-1621] Add support for FROM Class1 a1 JOIN Class2 a2 WITH cond queries Created: 25/Jan/12  Updated: 07/Sep/13

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

 Type: New Feature Priority: Major Reporter: Benjamin Eberlei Assignee: Alexander Resolution: Unresolved Votes: 1 Labels: None

 Description
 Check feasibility of this kind of query different from FROM Class1 a1, Class2 a2 to allow arbitrary joins between classes.

 Comment by Alex [ 30/Nov/12 ] Hi all! Maybe if this task is hard, you could do a simplier variant, "FROM Class1 a1 JOIN a1,a2 WITH a2 INSTANCE OF Class2"? Doctrine 2.3 supports it, but in fact, it does not work. I can't use Class2 fields in query, and Doctrine ignores the INSTANCE OF operator when building a native queries. I am working with system where I have many inherited classes with Class Table Inheritance. When I do a JOIN query, it generates native sql query more than 1KB(?!) length, and MySQL freezes for more than 7 minutes (?!) on it. It must join only tables for Class2, but it joins all my 20 tables inherited of my base class I don't know where to send bugreport It will be very good if I could manually select a joined class to make Doctrine do a better queries. Sorry for my english, I am from Moscow.

### [DDC-1723] Custom ID Generators Created: 22/Mar/12  Updated: 07/Sep/13

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

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

 Description
 Allow specify custom id generators, pull request is GH-206 https://github.com/doctrine/doctrine2/pull/206

### [DDC-1590] Fix Inheritance in Code-Generation Created: 09/Jan/12  Updated: 07/Sep/13

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

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

 Dependency is required for DDC-1579 MappedSuperClass and inheritance prob... Resolved

 Comment by Lukas Domnick [ 10/Dec/12 ] (I have no Link Privileges, but this one #DDC-1379 is a duplicate with more extent info.)

### [DDC-1624] Locking CTI doesnt work on SQL Server Created: 29/Jan/12  Updated: 03/Oct/13

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

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

 Duplicate is duplicated by DBAL-559 SQL Server Platform error on LOCK MOD... Resolved

 Description
 The WITH Keyowrd is appended to the whole FROM .. JOIN .. block instead of behind the FROM block.

### [DDC-2810] Doctrine\ORM\EntityNotFoundException - Entity was not found. Created: 21/Nov/13  Updated: 21/Nov/13

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

 Type: Bug Priority: Blocker Reporter: Timothy Lorens Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None Environment: Linux 2.6.32-358.18.1.el6.x86_64 #1 SMP Fri Aug 2 17:04:38 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux Server version: Apache/2.2.22 (Unix) PHP 5.3.3 (cli) (built: Jul 12 2013 04:36:18)

 Description
 Doctrine\ORM\EntityNotFoundException - Entity was not found. /zf2/framework/Infrastructure/Vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php:177 OneToOne join-side doesn't contain a matching record. One would assume this would just continue with an empty proxy object (full of null properties). The offending line of code is on line 750 of DOctrine\ORM\BasicEntityPersister.php. A quick fix/work-around was to replace the return null value with $entity which seems to be the object proxy class. Change this: return$entities ? $entities[0] : null; To This: return$entities ? $entities[0] :$entity;

### [DDC-2822] Replacing object in a OneToOne with OrphanRemoval=true isn't working as expected Created: 26/Nov/13  Updated: 29/Nov/13

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

 Type: Bug Priority: Blocker Reporter: Felipe Guaycuru Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: orm Environment: PHP 5.4

 Description
 So I have a class defined like this: class PhoneSettings { [...] /** @OneToOne(targetEntity="Medium", cascade= {"persist", "remove"} , orphanRemoval=true) @JoinColumn(name="medium_id", referencedColumnName="medium_id", nullable=true, onDelete="SET NULL") **/ protected $medium = null; [...] } And class Medium has no reference to the class Settings. Now suppose I have a$Settings object that is already persisted and has been correctly loaded. Also suppose that the $Settings object has a$medium (that is, $Settings->medium =$OldMedium) Now suppose I do: $Settings->medium =$NewMedium; Where $NewMedium is a different Medium object. When I persist$Settings, Doctrine does delete $OldMedium from the DB, but the problem is that it also deletes$NewMedium ... I have tried removing onDelete="SET NULL", but then I receive a "cannot delete, constraint failed" error...

### [DDC-2237] oracle IN statement with more than 1000 values Created: 11/Jan/13  Updated: 02/Apr/13

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

 Type: Bug Priority: Critical Reporter: Marc Drolet Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None

 Description
 If I have a query with a IN statement with more tahn 1000 values I get an sql error. I've try IN with implode: select * from test where id IN(' . implode(',', $values) . ') and I've also try with executeQuery: select * from test where id IN(:test) executeQuery($sql, array($values), array(\Doctrine\DBAL\Connection::PARAM_INT_ARRAY))  Comments  Comment by Marc Drolet [ 11/Jan/13 ] Here is the way I've implement the solution on my side: (for oracle) into Doctrine/DBAL/Statement.php, I've add this method: /** * Binds a parameter value to the statement. * This is implemented this way for oracle only. Other drivers are redirected to bindValue method. * * The value will be bound with to the type provided (that required to be a table type). * * @param String$name The name or position of the parameter. * @param Array $value The value of the parameter. * @param String$type The name of the type to use to bind. * @return boolean TRUE on success, FALSE on failure. */ public function bindList($name, Array$value, $type) { if ('oracle' !==$this->platform->getName()) { $this->bindValue($name, $value,$type); } else { return $this->stmt->bindList($name, $value,$type); } }  into Doctrine/DBAL/Driver/Statement.php I've add: /** * @TODO: docs */ function bindList($param, Array$values, $type);  into Doctrine/DBAL/Driver/OCI8/OCI8Statement.php I've add this method: /** * {@inheritdoc} */ public function bindList($param, Array $value,$type) { if (!($list = oci_new_collection($this->_dbh, $type))) { //throw new OCI8Exception::fromErrorInfo($this->errorInfo()); } foreach ($value as$entry) { $list->append($entry); } if (!oci_bind_by_name($this->_sth,$param, $list, -1, OCI_B_NTY)) { //throw new OCI8Exception::fromErrorInfo($this->errorInfo()); } }  // NOTE: we should probably add the bindList to all driver Statement object. into your code you can use it this way: $sql = " SELECT * FROM test WHERE id IN ( SELECT * FROM ( CAST (: p_ids AS list_int_type) ) ) ";$stmt = connection->prepare($sql);$stmt->bindList(': p_ids', $ids, 'list_int_type');$stmt->execute(); $rs =$stmt->fetchAll(PDO::FETCH_ASSOC);  NOTE: list_int_type need to be a valid oracle data type. You can create one with the name you want. example: you can have 2 type of accepted array of values: integer and string let's say we create one for string named: list_str_type and one for integer list_int_type create or replace type list_str_type as table of varchar2(4000); create or replace type list_int_type as table of number; Comment by Benjamin Eberlei [ 01/Apr/13 ] Hey Marc Drolet thanks for the feedback and the solution, however i would like to have something generic that is working independent of the database driver. This code is very specific. Can you point me to some documentation why oci collection works with more than 1000 elements and how it works in PHP? Comment by Marc Drolet [ 02/Apr/13 ] Hi Benjamin, The limitation is not from the oci driver, it's an oracle limitation. There are a couple of possible solution/implementation that can be done but the one I've provide is the one that perform better for the test I've done and from what I can found over the blogs I've read. I can't find the exact documentation of oracle. oracle doc is so poor. Here is the best description link I can provide that describe some possible implementation. http://vsadilovskiy.wordpress.com/substituting-a-collection-for-in-list-performance-study/ I don't know if there is similar limitation with other database. With the implementation I've provided, It will be possible to implement the proper solution depending on the database limitation you face otherwise it will execute the generic IN. What's bad, we need to create the type into the database. NOTE: In my case, I can not perform a sub-query, I get the my collection from a web service call.

### [DDC-2332] [UnitOfWork::doPersist()] The spl_objact_hash() generate not unique hash! Created: 05/Mar/13  Updated: 30/May/13

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

 Type: Bug Priority: Critical Reporter: Krisztián Ferenczi Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None Environment: Symfony 2.1.8, php 5.4.7 and php 5.4.12, Windows 7

 Attachments: hashlogs.txt

 Description
 I created fixtures and some data was inserted many times without calling the Task entity PrePersist event listener. I printed the used and generated hash and I saw a Proxies_CG_\Asitly\ProjectManagementBundle\Entity\User hash equal a Task entity hash!

 Comment by Marco Pivetta [ 05/Mar/13 ] Please provide either a code example or a test case. As it stands, this issue is incomplete Comment by Benjamin Eberlei [ 05/Mar/13 ] Are you calling EntityManager#clear() inbetween? Because PHP reuses the hashes. The ORM accounts for this. Comment by Benjamin Eberlei [ 05/Mar/13 ] This is not a reproduce case, i don't want to execute your whole project. I want to know, what is the actual bug that you see? Can you just print a list of all the hashes? Because the hashes dont differ at the end, bu tjust somewhere in the middle. Comment by Krisztián Ferenczi [ 05/Mar/13 ] I attached a hashlogs.txt file. The last Task class hash is 0000000050ab4aba0000000058e1cb12 ( line 3 129 ) This is not unique, view the line 2 760 . The Task is not being saved and the program don't call the prePersist listener. The "UnitOfWork" believe the entity has been saved because the isset($this->entityStates[$oid]) is true. But it is an other entity. Comment by Krisztián Ferenczi [ 06/Mar/13 ] The EntityManager::clear() fix the problem, but this is not "good" and "beautiful" solution. Shows no sign of that conflicts were and this is causing the problem. I was looking for the problem 7 hours.

### [DDC-2647] SSL Off Created: 03/Sep/13  Updated: 08/Sep/13

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

 Type: Improvement Priority: Critical Reporter: Eder Campelo Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None

 Description
 Hello all, How can i connect using SSL whit PostgreSQL? When i try, a have this error: SQLSTATE[08006] [7] FATAL: no pg_hba.conf entry for host "...", user "...", database "...", SSL off Gtraz

 Comment by Benjamin Eberlei [ 08/Sep/13 ] This is not yet possible, the Doctrine\DBAL\Driver\PDOPgSQL\Driver is missing this functionality. You can add a Pull Request to DBAL so that we can add it.

### [DDC-2768] Doctrine could not work with date as primary key Created: 30/Oct/13  Updated: 30/Oct/13

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

 Type: Bug Priority: Critical Reporter: Nikita Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None

 Description
 Part of my mapping:  id: statDate: type: date phrase: type: string bannerId: type: integer  So I've got an exception: Object of class DateTime could not be converted to string in /Users/hell0w0rd/dev/rsol/direct/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php line 13 45

### [DDC-2624] ManyToManyPersister fails to handle cloned PeristentCollections Created: 20/Aug/13  Updated: 18/Nov/13

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

 Type: Bug Priority: Critical Reporter: Martin Prebio Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 1 Labels: None

 Description
 I want to clone an entity and persist the clone. The entity itself works (if I reset the identifiers to null) but a M2M collection was first ignored since I only did a shallow copy. When I do a deep copy with the following, Doctrine throws the following exception: public function __clone() { if ($this->question_versions instanceof PersistentCollection) {$this->question_versions = clone $this->question_versions; } } Fatal error: Uncaught exception 'Doctrine\Common\Persistence\Mapping\MappingException' with message 'The class 'Doctrine\ORM\Persisters\ManyToManyPersister' was not found in the chain configured namespaces Foo\Entity' in /var/www/foo/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php on line 37 I've traced the error to the ManyToManyPersister class at the methods get {Delete,Insert} RowSQL where$coll->getOwner() is called which returns null because the owner is cleared when the collection is cloned. Therefore get_class does not work as expected under this circumstances. I've also tried to use $coll->getTypeClass() for$class at that point but this leads to other warnings ("array key not existing" and "spl_object hash got null") and finally an SQL exception because Doctrine is inserting null as one of the identifiers. There is a workaround for this issue but I think that this edge case should be handled too. The workaround is not to clone the collection itself but only copy the values with getValues() and let Doctrine convert it back to a collection.

 Comment by Martin Prebio [ 20/Aug/13 ] This issue may be related to DDC-2074 Comment by Marcin Iwański [ 18/Nov/13 ] I have the same problem on v2.4.1 after cloning collections in __clone() method of the entity, so seems that DDC-2074 didnt fix this case. But collection cloning is needed to properly manage cloned entity relationships. Comment by Martin Prebio [ 18/Nov/13 ] The getValues() workaround created some issues for us but I found another workaround. This one works for us for some time in a small to medium sized project where we heavily clone, detach and so on: __clone() { if ($this->m2mcoll instanceof PersistentCollection) {$this->m2mcoll = clone $this->m2mcoll;$this->m2mcoll->setOwner($this,$this->m2mcoll->getMapping()); } } The problem here is that this can not be put into the collection's clone method since it requires the entity object (which is $this). Comment by Marcin Iwański [ 18/Nov/13 ] Thanks Martin for your help, your workaround seems to work well in my case. I dont know yet if it has any drawbacks that may occur in longer time period. My general thought after dealing with entity cloning is that official manual should pay more attention to this topic, because I had to figure out most of the issues by myself. Comment by Martin Prebio [ 18/Nov/13 ] Yes, I've made the same experience regarding the documentation but still I haven't found time to contribute to it. Nevertheless if you run in any problems with my new workaround, please let me know of it. (I already spent some hours in the Doctrine code for some other issues) ### [DDC-2800] Something wrong with documentation generation Created: 18/Nov/13 Updated: 18/Nov/13 Status: Open Project: Doctrine 2 - ORM Component/s: None Affects Version/s: None Fix Version/s: None Security Level: All  Type: Documentation Priority: Critical Reporter: Flip Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None  Description  The ArrayCollection has a matching() function, but it does not show in the API docs. http://www.doctrine-project.org/api/common/2.4/class-Doctrine.Common.Collections.ArrayCollection.html ### [DDC-851] Automerge of detached entities passed to doctrine Created: 31/Oct/10 Updated: 30/Dec/10 Status: Open Project: Doctrine 2 - ORM Component/s: ORM Affects Version/s: 2.0-BETA4 Fix Version/s: None Security Level: All  Type: Improvement Priority: Major Reporter: Daniel Alvarez Arribas Assignee: Roman S. Borschel Resolution: Unresolved Votes: 0 Labels: None  Description  This is a feature request. Currently it is not possible to assign a detached entity to a relationship. You have to manually "merge" it, and only then you are able to assign it to relationships of managed objects. This can become complicated to do. The way it is now, when assigning an entity to a relationship in a process using a large number of entities, the entity's state needs to be checked and the entity possibly merged - all in userland code. This adds a level of complexity and potential for errors, while it could be solved transparently and elegantly within the ORM. There are ways to implement it in userland code, too, with moderate effort (see below), but this does not change the fact that responsibility for implementing a purely technical feature is delegated to the user, who could be spending his time much better writing business code. And if the user actually implements it, it will clutter the application with non-problem-domain code. To keep things simple, I propose Doctrine be extended to simply auto-merge any detached entities passed to it. That would save the programmer the manual tracking of object states and merge() calls. This would be especially handy when using cascades, as keeping track of deep object graphs in userland code would duplicate substantial ORM functionality. In programs that work with massive amounts of data, it is practically impossible to keep all entities managed due to resource constraints (see e.g. the batch processing patterns documented in the Doctrine 2 reference at http://www.doctrine-project.org/projects/orm/2.0/docs/reference/batch-processing/en). In a situation like that, one would probably simply flush and clear the entity manager regularly. Doctrine 2 currently forces the user to manually "merge" all persistent objects he/she still holds references to and wants to assign e.g. to other newly created persistable objects. I can not think of any reason why Doctrine 2 should not be able to do it automatically. Below is another comment originally attached to the GitHub proposal, containing a userland implementation of the feature as a temporary fix, for whoever cares. Here is a userland implementation for the functionality I am proposing, though I feel it is technical clutter that belongs into the ORM. Changing doctrine to be able to auto-merge unmanaged entities would be ideal. I thought I'd share this, for use as long as Doctrine 2 does not provide equivalent functionality. The implementation assumes all entities inherit from a base class (named "YourEntityBaseClass here") and intercepts the assignment to ToOne-relationships in a __set() method provided in that base class. For ToMany-relationships we extend ArrayCollection to intercept calls to add() and set() to accomplish the same. As an alternative to defining a __set() method in a base class you could also implement the interception by changing any mutator methods you define in your entities. But that would bloat your code quickly as you define more and more relationship attributes on your entities. The following __set() method implementation relies on reflection to parse the DocBlock-Comment with the Annotation and determine whether or not the property to be set is a ToOne-relationship.  public function __set($name, &$value) {$reflectionClass = new ReflectionClass($this);$property = $reflectionClass->getProperty($name); if ( self::isToOneRelationship($property) &&$value !== null) { $value = self::mergeIfDetached($value); } $this->$name = $value; }  The following is an implementation of mergeIfDetached(), that assumes there is a __get defined on the entity, to be able to access the protected mapped properties. public static function mergeIfDetached(YourEntityBaseClass$dataObject) { $doctrineEntityManager = DB::getDoctrineEntityManager(); if ($doctrineEntityManager->getUnitOfWork()->getEntityState($dataObject) == \Doctrine\ORM\UnitOfWork::STATE_DETACHED) {$dataObject = $doctrineEntityManager->merge($dataObject); } return $dataObject; }  For your purposes, consider DB to be just a class holding a reference to the Doctrine entity manager. Here are the helper methods for the reflection:  private static function isToOneRelationship(ReflectionProperty$property) { return self::matchDoctrineAnnotation($property, self::$doctrineToOneRelationshipAnnotation); } private static function matchDoctrineAnnotation(ReflectionProperty $property,$pattern) { return preg_match('/\@' . $pattern . '/',$property->getDocComment()) != 0; }  Here is the drop-in-replacement class for use with ToMany-Relationships. It uses the static reloadIfDetached method defined in the entity base class: use Doctrine\Common\Collections\ArrayCollection; class Collection extends ArrayCollection { public function set($key,$value) { $value = YourEntityBaseClass::mergeIfDetached($value); parent::set($key,$value); } public function add($value) {$value = YourEntityBaseClass::mergeIfDetached($value); return parent::add($value); } }  This approach keeps the amount of unnecessary code to a minimum, so that merges are not scattered throughout the problem-domain code.

 Comment by Daniel Alvarez Arribas [ 29/Dec/10 ] I have to note that the code I listed above turned out to be broken. There is nothing that guarantees that a data object just merged will not become detached again after being merged on assignment, unless the object is immediately persisted afterwards. The correct solution would be to merge all data objects found through relationships for a given data object, right from the persistence manager, immediately before calling persist() on the data object. I am currently using this solution (save() saves a data object safely for use within long-running batch jobs):  public static function save(DataObject $dataObject) { self::mergeRelatedDataObjectsIfDetached($dataObject); self::$doctrineEntityManager->persist($dataObject); } public static function merge(DataObject $dataObject) { return self::$doctrineEntityManager->merge($dataObject); } protected static function mergeRelatedDataObjectsIfDetached(DataObject$dataObject) { $reflectionClass = new ReflectionClass($dataObject); $properties =$reflectionClass->getProperties(); foreach ($properties as$property) { $propertyName =$property->getName(); $propertyValue =$dataObject->__get($propertyName); if (MetadataReader::isToOneRelationship($property)) { if ( $propertyValue !== null && !$propertyValue instanceof Proxy && self::isDetached($propertyValue)) {$relatedDataObject = self::merge($propertyValue);$dataObject->__set($propertyName,$relatedDataObject); } } else { if (MetadataReader::isToManyRelationship($property)) {$relatedDataObjects = $propertyValue->toArray(); foreach ($relatedDataObjects as $index =>$relatedDataObject) { if ( ! $relatedDataObject instanceof Proxy && self::isDetached($relatedDataObject)) { $relatedDataObject = self::merge($relatedDataObject); // Replace the entry in the collection with the merged copy. $propertyValue->set($index, $relatedDataObject); } } } } } } protected static function isDetached(DataObject$dataObject) { return self::$doctrineEntityManager->getUnitOfWork()->getEntityState($dataObject) == UnitOfWork::STATE_DETACHED; }  I still wish there would be an automerge feature, kind of Hibernate's "update". Comment by Daniel Alvarez Arribas [ 29/Dec/10 ] Wrapped the code sections into proper code blocks...

### [DDC-813] Validate Schema should complain on bi-directional relationships with mapped superclasses Created: 21/Sep/10  Updated: 29/Oct/12

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

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

 Description
 @ManyToOne and @OneToOne on mapped superclasses have to be unidirectional. The Schema Validator should verify this.

### [DDC-803] Create subselect queries within join statements Created: 14/Sep/10  Updated: 14/Sep/10

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

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

### [DDC-785] Post-Post-Persist event Created: 02/Sep/10  Updated: 14/Jan/11

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

 Type: Improvement Priority: Major Reporter: arnaud-lb Assignee: Roman S. Borschel Resolution: Unresolved Votes: 0 Labels: None

 Description
 postPersist/postUpdate events are triggered in the middle of a unitOfWork, and querying the DB in such events causes infinite loops. Doctrine attempts to flush the entity manager before running any query, which triggers flushing of entities, and postPersist/postUpdate events are triggered again. I did not checked, but the flush() before each query may be a performance problem too, if doctrine has to determine what has changed, depending on the changetracking policy. Also, it would be great if postPersist / postUpdate events were triggered after all entities have been persisted. It looks like that entities are flushed by groups of same 'type', and that events for a type are triggered once all of the elements of that group have been flushed, potentially before entities of an other type have been flushed : postPersist / postUpdate events are triggered while some other entities are still not flushed.

 Comment by Benjamin Eberlei [ 03/Sep/10 ] That is documented and for perfomance reasons we cannot move the preUpdate/postUpdate/prePersist/postPersist events to other locations inside the UnitOfWork. There is an onFlush event that allows for more flexibility and is triggered before any update/insert/delete is done by the UnitOfWork. Comment by arnaud-lb [ 04/Sep/10 ] Thanks. I understand that. Is there any chance of getting some onPostFlush or similar, which would be triggered like onFlush, but after all update/insert/delete ? Or just some post-something event which is allowed to issue db queries. Comment by Gediminas Morkevicius [ 24/Sep/10 ] onFlush you can store your entity for furher processing and on postPersist you can check if there are no more insertions and process the entity if it needs additional query I have faced all these issues and you can check http://github.com/l3pp4rd/DoctrineExtensions/tree/master/lib/DoctrineExtensions/Translatable/ for a solution to your problem Comment by Gediminas Morkevicius [ 14/Jan/11 ] I think this issue should be closed since the main reason of opening it was the possibility to execute additional queries when inserts were pending in unit of work. In current release it does not cause a flush during an additional query execution anymore.

### [DDC-779] Doctrine\ORM\Configuration should be immutable after construction of EntityManager Created: 30/Aug/10  Updated: 30/Aug/10

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

 Type: Improvement Priority: Major Reporter: Benjamin Eberlei Assignee: Roman S. Borschel Resolution: Unresolved Votes: 0 Labels: None

 Description
 Currently the Doctrine\ORM\Configuration instance is not immutable after construction of the EM, which can lead to funny behavior when changing essential dependencies such as caches or others.

### [DDC-769] Disabling discriminator column in WHERE clause Created: 26/Aug/10  Updated: 07/Sep/10

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

 Type: Improvement Priority: Major Reporter: Lars Strojny Assignee: Roman S. Borschel Resolution: Unresolved Votes: 1 Labels: None

 Description
 Per default Doctrine 2 adds an IN(...)-part to the query when hydrating an entity where a discriminator column is defined. While this makes sense as a default behavior, it would be pretty helpful if one could disable the WHERE-clause for discriminator columns alltogether for performance optimization.

 Comment by Roman S. Borschel [ 26/Aug/10 ] That would obviously produce wrong results. Maybe you can elaborate more with an example. Comment by Lars Strojny [ 07/Sep/10 ] I use ENUM("foo","bar") as discriminator columns. That means, the column will contain the right values out of the box, no further result set limiting required with WHERE.

### [DDC-1270] Incorrect QueryBuilder example Created: 11/Jul/11  Updated: 11/Jul/11

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

 Type: Documentation Priority: Major Reporter: Alex Bogomazov Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None

 Description

### [DDC-1197] Proxies should handle variable argument lists Created: 05/Jun/11  Updated: 05/Jun/11

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: Benjamin Eberlei Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None

 Description
 This is a contingency issue for https://github.com/doctrine/doctrine2/pull/60 "Fix to allow for proxy generated classes to respect methods in parent which may use func_get_args internally. Previously they would be passed nothing and thus fail. Also reduces need to build up argumentString. "

### [DDC-1164] doctrine:schema:update --force == doctrine:schema:create Created: 20/May/11  Updated: 20/May/11

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

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

 Description
 Doctrine:schema:update --force is the same as doctrine:schema:create. Under the hood, this may not be true, but they basically accomplish the same task. Schema:create should be removed, as it is redundant. Just look at django, one command to update db: ./manage.py syncdb Not saying that django gets everything correct, but the one command to synchronize the database is consistent. doctrine:schema:update should be smart enough to do all of the work, instead of relying on the redundant doctrine:schema:create.

### [DDC-1154] Proxies should take convention while loading *ToOne associations to reduce 1 extra query Created: 17/May/11  Updated: 17/May/11

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

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

 Description
 Read the IRC log: [2:38pm] guilhermeblanco: beberlei: ping [2:38pm] guilhermeblanco: I'm curious about a feature if Doctrine supports [2:38pm] guilhermeblanco: if we do this on a proxy: [2:38pm] guilhermeblanco: $proxy->getOneToOneAssoc() [2:39pm] guilhermeblanco: shouldn't Doctrine already populate the assoc entity? [2:39pm] guilhermeblanco: it would be an inner join [2:39pm] beberlei: how would doctrine know it needs it? [2:39pm] guilhermeblanco: beberlei: it always repass the ClassMetadata to Persister [2:40pm] guilhermeblanco: so all needed item is to also pass the fieldname/assocname [2:40pm] beberlei: but how would doctrine know getOneToOneASsoc() really returns this assoc [2:40pm] beberlei: it could contain any logic [2:40pm] guilhermeblanco: it wouldn't... but as soon as we trigger __load($fieldName) [2:40pm] guilhermeblanco: we know that we could populate not only the Proxy, but also assoc [2:40pm] beberlei: by convention? [2:40pm] guilhermeblanco: ya [2:41pm] beberlei: sounds good, can you open a ticket? [2:41pm] guilhermeblanco: getUser() would trigger __load('user') [2:41pm] guilhermeblanco: sure! [2:41pm] guilhermeblanco: I'll pastie this as content... it would be awesome to have [2:41pm] guilhermeblanco: I see a lot of queries here that could be optimized 

### [DDC-1144] How insert a AES_ENCRYPT value in a table field Created: 10/May/11  Updated: 10/May/11

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

 Type: New Feature Priority: Major Reporter: dquintard Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None Environment: Win XP, MySql5, Php5.3, ZendFramework 1.11.4

 Description

### [DDC-1016] Example code does not reflect real code Created: 03/Feb/11  Updated: 03/Feb/11

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

 Type: Documentation Priority: Major Reporter: thoth Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None Environment: Website

 Description
 http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html#entity-state In the switch cases all the UnitOfWork constants are invalid. Example: UnitOfWork::NEW instead of being UnitOfWork::STATE_NEW

### [DDC-1011] Finding out if a model is persist Created: 02/Feb/11  Updated: 02/Feb/11

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

 Type: Documentation Priority: Major Reporter: Ronny Deter Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None

 Description
 To find out if a model is persist, is missing in the documentation of doctrine 2. To become the state of an model you must call the entitymanager->getUnitOfWork()->getEntityState(model)

### [DDC-998] Code example for custom AST functions incorrect Created: 23/Jan/11  Updated: 23/Jan/11

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

 Type: Documentation Priority: Major Reporter: Timo A. Hummel Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None

 Description
 On http://www.doctrine-project.org/docs/orm/2.0/en/reference/dql-doctrine-query-language.html#adding-your-own-functions-to-the-dql-language the code example is slightly incorrect. Mistakes: Lexer::T_ABS doesn't exist anymore, I assume Lexer::T_IDENTIFIER is what one wants to use Missing use for \Doctrine\ORM\Query\Lexer Additionally, the section should tell the user that he best has a look at lib/Doctrine/ORM/Query/AST/Functions/* to learn how to write custom functions. It also could be noted that stored procedures can be called with custom functions.

### [DDC-999] DQL always needs a FROM clause, should be changed Created: 23/Jan/11  Updated: 23/Jan/11

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

 Type: New Feature Priority: Major Reporter: Timo A. Hummel Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 1 Labels: None

 Description
 Sometimes a developer needs to issue a query without a FROM clause. This especially occurs using the QueryBuilder, when you may or may not have a table to select from, but call a stored procedure always. Example: $query =$em>createQuery('SELECT (1+1)');  The above query fails because the lexer expects T_FROM. If you replace (1+1) with a stored procedure, this example makes more sense. One might argue about that you should use DBAL directly, but I disagree, because it always can happen that you end up in a situation like this: $qb =$em->createQueryBuilder(); $qb->select("SOMEFANCYPROCEDURE()"); if ($condition) { $qb =$qb->from("additionalTable t"); } 

### [DDC-993] Cookbook: Overriding the ID Generator during a database migration Created: 19/Jan/11  Updated: 28/Oct/12

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

 Type: Documentation Priority: Major Reporter: Timo A. Hummel Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 1 Labels: None

 Description
 If you need to override the ID Generator, e.g. during a migration, you can do that in your migration script as follows: Overriding the ID generator $em->getClassMetadata('foo\bar\Entity')->setIdGenerator(new \Doctrine\ORM\Id\AssignedGenerator());$em->getClassMetadata('foo\bar\Entity')->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_NONE')); Make sure that both calls equal to the same generator type. You can now modify the @Id fields in your entities. Additionally, make sure that you set the IdGenerator after you created the database using e.g. SchemaTool->create().

 Comment by Endre Kósa [ 27/Oct/12 ] Hi, this doesn't seem to work for me. I have written a small database export / import utility. As long as I use the automatic ID generation, everything works flawlessly, but I'm trying to preserve the existing IDs. I do exactly what you've suggested in your post. It works for @OneToOne relations, but I get the following error messages when persisting entities that are parts of @ManyToOne relations: Notice: Undefined index: [....] in [...]Doctrine/ORM/UnitOfWork.php on line 2655 I'm using version 2.2.2 Am I doing something wrong? Comment by Endre Kósa [ 28/Oct/12 ] Never mind. I've upgraded to Doctrine 2.3.0 and it works as expected.

### [DDC-946] Evaluate optional use of igbinary for serialization Created: 22/Dec/10  Updated: 22/Dec/10

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

 Type: Improvement Priority: Major Reporter: Benjamin Eberlei Assignee: Roman S. Borschel Resolution: Unresolved Votes: 1 Labels: None

 Description
 Igbinary is supposed to be faster and better than serialize/unserialize(). We should check if its relevant for us (metadata and query caching for example): https://github.com/phadej/igbinary

 Comment by Benjamin Eberlei [ 22/Dec/10 ] http://ilia.ws/archives/211-Igbinary,-The-great-serializer.html#extended

### [DDC-930] A table cannot have more than one many to many relationship with the same table when using reverse engineer Created: 13/Dec/10  Updated: 13/Dec/10

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

 Type: Improvement Priority: Major Reporter: Jiri Helmich Assignee: Roman S. Borschel Resolution: Unresolved Votes: 0 Labels: None Environment: FreeBSD, PostgreSQL 8.4

 Description
 This is caused by taking the join column name as the identifier while generating a property name for annotation. The mapping driver detects that the same property is already defined and ends the convert process. A little bit smarter approach for me was to take the local table name. But this assumes a specific style of join table naming convention. Doctrine\ORM\Mapping\Driver\DatabaseDriver::loadMetadataForClass() Replace: $associationMapping['fieldName'] = Inflector::camelize(str_replace('_id', '', strtolower(current($otherFk->getColumns())))); With: $name = explode("_",$myFk->getLocalTableName()); if (count($name) > 1) { array_shift($name); } $name = implode("_",$name); $associationMapping['fieldName'] = Inflector::camelize(str_replace('_id', '', strtolower($name))); Maybe to switch to this behavior with an additional option?

### [DDC-923] Add note about DateTime Query Parameter Type Hint Created: 10/Dec/10  Updated: 10/Dec/10

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

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

### [DDC-919] subselect Created: 08/Dec/10  Updated: 20/Mar/11

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

 Type: Documentation Priority: Major Reporter: Mungiu Dragos Assignee: Roman S. Borschel Resolution: Unresolved Votes: 0 Labels: None

 Description
 i'd like to see more example in documentation with this subselects [23:08] can you open a tciket on jira? then i dont forget to do that when i have time

 Comment by Alberto [ 20/Mar/11 ] Subselect as columns or FROM clause should have mor examples.

### [DDC-1475] Documentation for One-To-Many, Bidirectional Association does not have YAML example Created: 07/Nov/11  Updated: 07/Nov/11

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

 Type: Documentation Priority: Major Reporter: Christian Stoller Assignee: Benjamin Eberlei Resolution: Unresolved Votes: 0 Labels: None

 Description
 When you are looking for a config example for the bidirectional mapping of an one-to-many association you will just find an example with XML, but not with YAML or PHP. It would be nice if somebody could add an example or a link to the bidirectional one-to-one association, because it should be the same, right? Here the link to the example: http://www.doctrine-project.org/docs/orm/2.0/en/reference/association-mapping.html#one-to-many-bidirectional

### [DDC-1465] Fetching partial objects doesn't work if HINT_FORCE_PARTIAL_LOAD is not explicitly used Created: 02/Nov/11  Updated: 11/Nov/11

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

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

 Duplicate duplicates DDC-624 Partial object query that leaves out ... Open

 Description
 Using the DQL "partial" keyword is not enough to get a partial entity as a result. The DQL hint HINT_FORCE_PARTIAL_LOAD must be used as well. $q =$em->createQuery('SELECT partial r.{id,comment} FROM Entities\Rating r WHERE r.id=3'); $r =$q->getResult() /* HYDRATE_OBJECT is the default hydration mode */  Here, $r contains the full Entity, a SELECT * has been sent $q = $em->createQuery('SELECT partial r.{id,comment} FROM Entities\Rating r WHERE r.id=3');$q->setHint(Doctrine\ORM\Query::HINT_FORCE_PARTIAL_LOAD, 1); $r =$q->getResult() /* HYDRATE_OBJECT is the default hydration mode */  Here, \$r contains only the selected fields, hence a true partial Entity

### [DDC-1459] Move DDC-331, DDC-448, DDC-493, DDC-513, DDC-698 Tests into SQLGeneration Testsuite Created: 29/Oct/11  Updated: 01/Aug/12

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

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

### [DDC-1443] Subscribers reachs maximum nesting level when creating association on pre/postPersist with cascade persist Created: 20/Oct/11  Updated: 29/Oct/11

Status: Open
Project: Doctrine 2 - ORM
Component/s: