DDC-2838: Leaky abstraction when applying Criteria to hydrated/non-hydrated PersistentCollection #3543

Closed
opened 2026-01-22 14:21:52 +01:00 by admin · 10 comments
Owner

Originally created by @doctrinebot on GitHub (Dec 3, 2013).

Originally assigned to: @Ocramius, @alcaeus on GitHub.

Jira issue originally created by user ptlis:

When applying a Criteria to a PersistentCollection that has been hydrated the field names must be camel case, if the collection has not yet been hydrated the field names must be underscore separated.

The github repo linked here contains a simplified testcase for the matrix of hydrated/non-hydrated entities and camel case/underscore separated fields.

https://github.com/ptlis/DoctrineTestcase

Originally created by @doctrinebot on GitHub (Dec 3, 2013). Originally assigned to: @Ocramius, @alcaeus on GitHub. Jira issue originally created by user ptlis: When applying a Criteria to a PersistentCollection that has been hydrated the field names must be camel case, if the collection has not yet been hydrated the field names must be underscore separated. The github repo linked here contains a simplified testcase for the matrix of hydrated/non-hydrated entities and camel case/underscore separated fields. https://github.com/ptlis/DoctrineTestcase
admin added the Bug label 2026-01-22 14:21:52 +01:00
admin closed this issue 2026-01-22 14:21:52 +01:00
Author
Owner
@doctrinebot commented on GitHub (Dec 3, 2013): - is referenced by [DCOM-275: Collections\Expr\ClosureExpressionVisitor should support private properties as well as SQL visitors do.](http://www.doctrine-project.org/jira/browse/DCOM-275) - is referenced by [DCOM-249: Criteria are unable to locate getters for properties with an underscore prefix](http://www.doctrine-project.org/jira/browse/DCOM-249)
Author
Owner

@doctrinebot commented on GitHub (Aug 18, 2014):

Comment created by @ocramius:

We can't check out an entire project just to test a bug.

Please write an actual functional test case that can be integrated into the Doctrine ORM test suite.

@doctrinebot commented on GitHub (Aug 18, 2014): Comment created by @ocramius: We can't check out an entire project just to test a bug. Please write an actual functional test case that can be integrated into the Doctrine ORM test suite.
Author
Owner

@doctrinebot commented on GitHub (Aug 20, 2014):

Comment created by ptlis:

Hi,

i'm happy to do so - i'll take a look at this over the weekend.

@doctrinebot commented on GitHub (Aug 20, 2014): Comment created by ptlis: Hi, i'm happy to do so - i'll take a look at this over the weekend.
Author
Owner

@doctrinebot commented on GitHub (Dec 12, 2014):

Comment created by derula:

[~ptlis]: Any progress on this? This is currently an issue for us as well and hope to get fixed. I could look into converting it to a test for integration with the test suite if you don't have the time... but it might take a while since I have no experience with the requirements that should be met. (Plus, I am not sure how tightly coupled it is with your project)

@doctrinebot commented on GitHub (Dec 12, 2014): Comment created by derula: [~ptlis]: Any progress on this? This is currently an issue for us as well and hope to get fixed. I could look into converting it to a test for integration with the test suite if you don't have the time... but it might take a while since I have no experience with the requirements that should be met. (Plus, I am not sure how tightly coupled it is with your project)
Author
Owner

@doctrinebot commented on GitHub (Dec 17, 2014):

Comment created by derula:

Hi [ocramius], [ptlis],

I attached a functional Test that integrates with the test suite. Please let me know if I should issue a PR, and I'll do that this evening.

@doctrinebot commented on GitHub (Dec 17, 2014): Comment created by derula: Hi [<sub>ocramius], [</sub>ptlis], I attached a functional Test that integrates with the test suite. Please let me know if I should issue a PR, and I'll do that this evening.
Author
Owner

@doctrinebot commented on GitHub (Dec 26, 2014):

Comment created by floeh:

+1

@doctrinebot commented on GitHub (Dec 26, 2014): Comment created by floeh: +1
Author
Owner

@doctrinebot commented on GitHub (Jun 26, 2015):

Comment created by derula:

My idea to solve this would go like this:

  • Add a new class ObjectCollection in Common that implements Collection and Selectable, but requires class metadata.
  • Whenever creating an ArrayCollection with entities / other objects, create an ObjectCollection instead.

The only thing that's causing me a headache is that ideally, there should be code sharing in some form between the matching() implementations of ObjectCollection and PersistentCollection, because both will use class metadata. Maybe this can be achieved somehow using a trait?

If you like the idea, I could look into it further.

@doctrinebot commented on GitHub (Jun 26, 2015): Comment created by derula: My idea to solve this would go like this: - Add a new class ObjectCollection in Common that implements Collection and Selectable, but requires class metadata. - Whenever creating an ArrayCollection with entities / other objects, create an ObjectCollection instead. The only thing that's causing me a headache is that ideally, there should be code sharing in some form between the matching() implementations of ObjectCollection and PersistentCollection, because both will use class metadata. Maybe this can be achieved somehow using a trait? If you like the idea, I could look into it further.
Author
Owner

@ostrolucky commented on GitHub (May 14, 2017):

I tried this and it seems to be no longer reproducible with provided demo repository. @ptlis can you confirm?

@ostrolucky commented on GitHub (May 14, 2017): I tried this and it seems to be no longer reproducible with provided demo repository. @ptlis can you confirm?
Author
Owner

@ostrolucky commented on GitHub (May 22, 2017):

This has been fixed via 32d524547e you can close this guys @Ocramius

@ostrolucky commented on GitHub (May 22, 2017): This has been fixed via https://github.com/doctrine/collections/pull/57/commits/32d524547eb452718f85aa76b5cee4f7460c8fd0 you can close this guys @Ocramius
Author
Owner

@alcaeus commented on GitHub (May 23, 2017):

Thanks @ostrolucky!

@alcaeus commented on GitHub (May 23, 2017): Thanks @ostrolucky!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3543