src/ORM/DataObject.php
protected function duplicateManyManyRelations($sourceObject, $destinationObject, $filter)
    {
        Deprecation::notice('5.0', 'Use duplicateRelations() instead');

        // Get list of relations to duplicate
        if ($filter === 'many_many' || $filter === 'belongs_many_many') {
            $relations = $sourceObject->config()->get($filter);
        } elseif ($filter === true) {
            $relations = $sourceObject->manyMany();
        } else {
            throw new InvalidArgumentException("Invalid many_many duplication filter");
        }
        foreach ($relations as $manyManyName => $type) {
            $this->duplicateManyManyRelation($sourceObject, $destinationObject, $manyManyName);
        }
    }
protected function duplicateManyManyRelations($sourceObject, $destinationObject, $filter)
    {
        Deprecation::notice('5.0', 'Use duplicateRelations() instead');

        // Get list of relations to duplicate
        if ($filter === 'many_many' || $filter === 'belongs_many_many') {
            $relations = $sourceObject->config()->get($filter);
        } elseif ($filter === true) {
            $relations = $sourceObject->manyMany();
        } else {
            throw new InvalidArgumentException("Invalid many_many duplication filter");
        }
        foreach ($relations as $manyManyName => $type) {
            $this->duplicateManyManyRelation($sourceObject, $destinationObject, $manyManyName);
        }
    }
protected function duplicateManyManyRelations ( $ sourceObject , $ destinationObject , $ filter ) { Deprecation :: notice ( '5.0' , 'Use duplicateRelations() instead' ) ; // Get list of relations to duplicate if ( $ filter === 'many_many' || $ filter === 'belongs_many_many' ) { $ relations = $ sourceObject -> config ( ) -> get ( $ filter ) ; } elseif ( $ filter === true ) { $ relations = $ sourceObject -> manyMany ( ) ; } else { throw new InvalidArgumentException ( "Invalid many_many duplication filter" ) ; } foreach ( $ relations as $ manyManyName => $ type ) { $ this -> duplicateManyManyRelation ( $ sourceObject , $ destinationObject , $ manyManyName ) ; } }
Copies the many_many and belongs_many_many relations from one object to another instance of the name of object.

@deprecated 4.1.0:5.0.0 Use duplicateRelations() instead
@param DataObject $sourceObject the source object to duplicate from
@param DataObject $destinationObject the destination object to populate with the duplicated relations
@param bool|string $filter
Copies the many_many and belongs_many_many relations from one object to another instance of the name of object .