public function duplicate($doWrite = true, $manyMany = 'many_many')
    {
        // Versioned 1.0 has a bug where [] will result in _all_ relations being duplicated
        if ($manyMany === 'many_many' && !$this->manyMany()) {
            $manyMany = null;
        }

        $clonedNode = parent::duplicate(true, $manyMany);

        foreach ($this->Options() as $field) {
            /** @var EditableOption $newField */
            $newField = $field->duplicate(false);
            $newField->ParentID = $clonedNode->ID;
            $newField->Version = 0;
            $newField->write();
        }

        return $clonedNode;
    }
public function duplicate($doWrite = true, $manyMany = 'many_many')
    {
        // Versioned 1.0 has a bug where [] will result in _all_ relations being duplicated
        if ($manyMany === 'many_many' && !$this->manyMany()) {
            $manyMany = null;
        }

        $clonedNode = parent::duplicate(true, $manyMany);

        foreach ($this->Options() as $field) {
            /** @var EditableOption $newField */
            $newField = $field->duplicate(false);
            $newField->ParentID = $clonedNode->ID;
            $newField->Version = 0;
            $newField->write();
        }

        return $clonedNode;
    }
public function duplicate ( $ doWrite = true , $ manyMany = 'many_many' ) { // Versioned 1.0 has a bug where [] will result in _all_ relations being duplicated if ( $ manyMany === 'many_many' && ! $ this -> manyMany ( ) ) { $ manyMany = null ; } $ clonedNode = parent :: duplicate ( true , $ manyMany ) ; foreach ( $ this -> Options ( ) as $ field ) { /** @var EditableOption $newField */ $ newField = $ field -> duplicate ( false ) ; $ newField -> ParentID = $ clonedNode -> ID ; $ newField -> Version = 0 ; $ newField -> write ( ) ; } return $ clonedNode ; }
Duplicate a pages content. We need to make sure all the fields attached
to that page go with it

{@inheritDoc}
Duplicate a pages content . We need to make sure all the fields attached to that page go with it