src/BoomCMS/Database/Models/Page.php
public function addVersion(array $attrs = []): PageVersionInterface
    {
        if ($oldVersion = $this->getCurrentVersion()) {
            $attrs += $oldVersion->toArray();
        }

        // Chunk type and ID fields shouldn't be copied.
        unset($attrs[PageVersion::ATTR_CHUNK_TYPE]);
        unset($attrs[PageVersion::ATTR_CHUNK_ID]);
        unset($attrs[PageVersion::ATTR_RESTORED_FROM]);

        $newVersion = new PageVersion($attrs);
        $newVersion->setPage($this);

        /*
         * Only make the new version a draft if the old version is published.
         * When a new page is created we set the edited_at time to make the first version published
         */
        if ($oldVersion->isPublished()) {
            $newVersion->makeDraft();
        }

        $newVersion->save();

        $this->setCurrentVersion($newVersion);

        return $this->getCurrentVersion();
    }
public function addVersion(array $attrs = []): PageVersionInterface
    {
        if ($oldVersion = $this->getCurrentVersion()) {
            $attrs += $oldVersion->toArray();
        }

        // Chunk type and ID fields shouldn't be copied.
        unset($attrs[PageVersion::ATTR_CHUNK_TYPE]);
        unset($attrs[PageVersion::ATTR_CHUNK_ID]);
        unset($attrs[PageVersion::ATTR_RESTORED_FROM]);

        $newVersion = new PageVersion($attrs);
        $newVersion->setPage($this);

        /*
         * Only make the new version a draft if the old version is published.
         * When a new page is created we set the edited_at time to make the first version published
         */
        if ($oldVersion->isPublished()) {
            $newVersion->makeDraft();
        }

        $newVersion->save();

        $this->setCurrentVersion($newVersion);

        return $this->getCurrentVersion();
    }
public function addVersion ( array $ attrs = [ ] ) : PageVersionInterface { if ( $ oldVersion = $ this -> getCurrentVersion ( ) ) { $ attrs += $ oldVersion -> toArray ( ) ; } // Chunk type and ID fields shouldn't be copied. unset ( $ attrs [ PageVersion :: ATTR_CHUNK_TYPE ] ) ; unset ( $ attrs [ PageVersion :: ATTR_CHUNK_ID ] ) ; unset ( $ attrs [ PageVersion :: ATTR_RESTORED_FROM ] ) ; $ newVersion = new PageVersion ( $ attrs ) ; $ newVersion -> setPage ( $ this ) ; /*
         * Only make the new version a draft if the old version is published.
         * When a new page is created we set the edited_at time to make the first version published
         */ if ( $ oldVersion -> isPublished ( ) ) { $ newVersion -> makeDraft ( ) ; } $ newVersion -> save ( ) ; $ this -> setCurrentVersion ( $ newVersion ) ; return $ this -> getCurrentVersion ( ) ; }
Adds a new version to the page.

If the current version is embargoed then the new version is also embargoed.
If the current version is published then the new version becomes a draft.
Adds a new version to the page .