public function setParent($item)
    {
        if (is_object($item)) {
            if (!$item->exists()) {
                $item->write();
            }
            $this->setField("ParentID", $item->ID);
        } else {
            $this->setField("ParentID", $item);
        }
    }
public function setParent($item)
    {
        if (is_object($item)) {
            if (!$item->exists()) {
                $item->write();
            }
            $this->setField("ParentID", $item->ID);
        } else {
            $this->setField("ParentID", $item);
        }
    }
public function setParent ( $ item ) { if ( is_object ( $ item ) ) { if ( ! $ item -> exists ( ) ) { $ item -> write ( ) ; } $ this -> setField ( "ParentID" , $ item -> ID ) ; } else { $ this -> setField ( "ParentID" , $ item ) ; } }
Make this page a child of another page.

If the parent page does not exist, resolve it to a valid ID before updating this page's reference.

@param SiteTree|int $item Either the parent object, or the parent ID
Make this page a child of another page .