private function addToChangeSet(
        EntityManagerInterface $em,
        ClassMetadata $metadata,
        $entity,
        array &$change_set
    ) {
        if (!isset($change_set[$metadata->rootEntityName])) {
            $change_set[$metadata->rootEntityName] = [];
        }

        if (!in_array($entity, $change_set[$metadata->rootEntityName], true)) {
            $change_set[$metadata->rootEntityName][] = $entity;

            // recursively find all changes
            $this->appendAssociations($em, $metadata, $entity, $change_set);
        }
    }
private function addToChangeSet(
        EntityManagerInterface $em,
        ClassMetadata $metadata,
        $entity,
        array &$change_set
    ) {
        if (!isset($change_set[$metadata->rootEntityName])) {
            $change_set[$metadata->rootEntityName] = [];
        }

        if (!in_array($entity, $change_set[$metadata->rootEntityName], true)) {
            $change_set[$metadata->rootEntityName][] = $entity;

            // recursively find all changes
            $this->appendAssociations($em, $metadata, $entity, $change_set);
        }
    }
private function addToChangeSet ( EntityManagerInterface $ em , ClassMetadata $ metadata , $ entity , array & $ change_set ) { if ( ! isset ( $ change_set [ $ metadata -> rootEntityName ] ) ) { $ change_set [ $ metadata -> rootEntityName ] = [ ] ; } if ( ! in_array ( $ entity , $ change_set [ $ metadata -> rootEntityName ] , true ) ) { $ change_set [ $ metadata -> rootEntityName ] [ ] = $ entity ; // recursively find all changes $ this -> appendAssociations ( $ em , $ metadata , $ entity , $ change_set ) ; } }
Add an entity to the change set. This also adds any elements to the
change set that are in the associations.

@param EntityManagerInterface $em
@param ClassMetadata          $metadata
@param mixed                  $entity
@param array                  $change_set
Add an entity to the change set . This also adds any elements to the change set that are in the associations .