Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1219

Remove dependancy on Collection interface in Domain Objects

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1
    • Fix Version/s: 2.x
    • Component/s: ORM
    • Security Level: All
    • 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"?

        Activity

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            André R.
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: