public function duplicate($doWrite = true, $manyMany = "many_many")
    {
        $clone = parent::duplicate($doWrite);

        // Ensure we clone any customisations
        if ($doWrite) {
            foreach ($this->Customisations() as $customisation) {
                $new_item = $customisation->duplicate(false);
                $new_item->ParentID = $clone->ID;
                $new_item->write();
            }
        }

        return $clone;
    }
public function duplicate($doWrite = true, $manyMany = "many_many")
    {
        $clone = parent::duplicate($doWrite);

        // Ensure we clone any customisations
        if ($doWrite) {
            foreach ($this->Customisations() as $customisation) {
                $new_item = $customisation->duplicate(false);
                $new_item->ParentID = $clone->ID;
                $new_item->write();
            }
        }

        return $clone;
    }
public function duplicate ( $ doWrite = true , $ manyMany = "many_many" ) { $ clone = parent :: duplicate ( $ doWrite ) ; // Ensure we clone any customisations if ( $ doWrite ) { foreach ( $ this -> Customisations ( ) as $ customisation ) { $ new_item = $ customisation -> duplicate ( false ) ; $ new_item -> ParentID = $ clone -> ID ; $ new_item -> write ( ) ; } } return $ clone ; }
Overwrite default duplicate function

@param boolean $doWrite (write the cloned object to DB)
@return DataObject $clone The duplicated object
Overwrite default duplicate function