public function newInstance(
        string $createdByUserId,
        string $createdReason = Tracking::UNKNOWN_REASON
    ) {
        /** @var ContainerInterface|ContainerAbstract $new */
        $new = parent::newInstance(
            $createdByUserId,
            $createdReason
        );

        $new->lastPublished = new \DateTime();

        $new->revisions = new ArrayCollection();

        if (!empty($new->publishedRevision)) {
            $revision = $new->publishedRevision->newInstance(
                $createdByUserId,
                $createdReason
            );
            $new->removePublishedRevision();
            $new->revisions->add($revision);
            $new->setStagedRevision($revision);
        } elseif (!empty($new->stagedRevision)) {
            $revision = $new->stagedRevision->newInstance(
                $createdByUserId,
                $createdReason
            );
            $new->setStagedRevision($revision);
            $new->revisions->add($revision);
        }

        return $new;
    }
public function newInstance(
        string $createdByUserId,
        string $createdReason = Tracking::UNKNOWN_REASON
    ) {
        /** @var ContainerInterface|ContainerAbstract $new */
        $new = parent::newInstance(
            $createdByUserId,
            $createdReason
        );

        $new->lastPublished = new \DateTime();

        $new->revisions = new ArrayCollection();

        if (!empty($new->publishedRevision)) {
            $revision = $new->publishedRevision->newInstance(
                $createdByUserId,
                $createdReason
            );
            $new->removePublishedRevision();
            $new->revisions->add($revision);
            $new->setStagedRevision($revision);
        } elseif (!empty($new->stagedRevision)) {
            $revision = $new->stagedRevision->newInstance(
                $createdByUserId,
                $createdReason
            );
            $new->setStagedRevision($revision);
            $new->revisions->add($revision);
        }

        return $new;
    }
public function newInstance ( string $ createdByUserId , string $ createdReason = Tracking :: UNKNOWN_REASON ) { /** @var ContainerInterface|ContainerAbstract $new */ $ new = parent :: newInstance ( $ createdByUserId , $ createdReason ) ; $ new -> lastPublished = new \ DateTime ( ) ; $ new -> revisions = new ArrayCollection ( ) ; if ( ! empty ( $ new -> publishedRevision ) ) { $ revision = $ new -> publishedRevision -> newInstance ( $ createdByUserId , $ createdReason ) ; $ new -> removePublishedRevision ( ) ; $ new -> revisions -> add ( $ revision ) ; $ new -> setStagedRevision ( $ revision ) ; } elseif ( ! empty ( $ new -> stagedRevision ) ) { $ revision = $ new -> stagedRevision -> newInstance ( $ createdByUserId , $ createdReason ) ; $ new -> setStagedRevision ( $ revision ) ; $ new -> revisions -> add ( $ revision ) ; } return $ new ; }
Get a clone with special logic
Any copy will be changed to staged

@param string $createdByUserId
@param string $createdReason

@return ContainerInterface|ContainerAbstract
Get a clone with special logic Any copy will be changed to staged