Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-2838

Leaky abstraction when applying Criteria to hydrated/non-hydrated PersistentCollection

    Details

    • Type: Bug
    • Status: Awaiting Feedback
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.4.1, 2.6.0
    • Fix Version/s: None
    • Component/s: ORM
    • Labels:
      None

      Description

      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

        Issue Links

          Activity

          Hide
          ocramius Marco Pivetta added a comment -

          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.

          Show
          ocramius Marco Pivetta added a comment - 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.
          Hide
          ptlis brian ridley added a comment -

          Hi,

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

          Show
          ptlis brian ridley added a comment - Hi, i'm happy to do so - i'll take a look at this over the weekend.
          Hide
          derula Simon Paridon added a comment -

          brian ridley: 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)

          Show
          derula Simon Paridon added a comment - brian ridley : 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)
          Hide
          derula Simon Paridon added a comment -

          Hi Marco Pivetta, brian ridley,

          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.

          Show
          derula Simon Paridon added a comment - Hi Marco Pivetta , brian ridley , 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.
          Hide
          floeh Florian Preusner added a comment -

          +1

          Show
          floeh Florian Preusner added a comment - +1
          Hide
          derula Simon Paridon added a comment -

          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.

          Show
          derula Simon Paridon added a comment - 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.

            People

            • Assignee:
              ocramius Marco Pivetta
              Reporter:
              ptlis brian ridley
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: