Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-216

PersistentCollection#toArray() should call _initialize()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-ALPHA3
    • Fix Version/s: 2.0-ALPHA4
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      Doctrine trunk

      Description

      Calling toArray on a PersistentCollection does not initialize the collection. This means that a not yet initialized collection returns an empty array. This is not expected behavior. The user expects the collection to be initialized and the objects returned. Calling count first is a workaround to initialize the array because count calls _initialize.

      A use case is an accessor wanting to return an array to not expose the collection to modification.

        Issue Links

          Activity

          Hide
          Roman S. Borschel added a comment -

          Should be fixed now.

          Show
          Roman S. Borschel added a comment - Should be fixed now.

            People

            • Assignee:
              Roman S. Borschel
              Reporter:
              Ismo Toijala
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: