Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-204

ActiveEntity persistent object recursion on self referencing class

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0-ALPHA4
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      When using a self-referencing relationship, for example:

        /**
         * @ManyToOne(targetEntity="Collection")
         * @JoinColumn(name="parent_id", referencedColumnName="id")
         * 
         * @var Collection
         */
        protected $parent;
      

      ActiveEntity::toArray() recurses through all parents and children.

      This was all working fine until my database actually started getting some data... then XDebug stopped me with a "Maximum function nesting level of '100' reached, aborting!" error.

      ..
      ..
      95 0.2574 14222056 Proxies\CollectionProxy->toArray( ) ..\ActiveEntity.php:164 
      96 0.2574 14222056 DoctrineExtensions\ActiveEntity->toArray( ) ..\CollectionProxy.php:183 
      97 0.2576 14231520 Proxies\CollectionProxy->toArray( ) ..\ActiveEntity.php:173 
      98 0.2576 14231520 DoctrineExtensions\ActiveEntity->toArray( ) ..\CollectionProxy.php:183 
      99 0.2576 14231736 Doctrine\ORM\EntityManager->getClassMetadata( ) ..\ActiveEntity.php:150 
      

      The PersistentCollection object does not have a state so cannot be locked in the same was as an ActiveEntity object can - maybe it needs a lockable state for this to work?

        Activity

        Hide
        Jonathan H. Wage added a comment -

        Is this still a problem or has it been fixed?

        Show
        Jonathan H. Wage added a comment - Is this still a problem or has it been fixed?

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Russ Flynn (rooster)
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: