src/Versioned.php
public function updateInheritableQueryParams(&$params)
    {
        // Skip if versioned isn't set
        if (!isset($params['Versioned.mode'])) {
            return;
        }

        // Adjust query based on original selection criterea
        switch ($params['Versioned.mode']) {
            case 'all_versions':
            {
                // Versioned.mode === all_versions doesn't inherit very well, so default to stage
                $params['Versioned.mode'] = 'stage';
                $params['Versioned.stage'] = static::DRAFT;
                break;
            }
            case 'version':
            {
                // If we selected this object from a specific version, we need
                // to find the date this version was published, and ensure
                // inherited queries select from that date.
                $version = $params['Versioned.version'];
                $dateAndStage = $this->getLastEditedAndStageForVersion($version);

                // Filter related objects at the same date as this version
                unset($params['Versioned.version']);
                if ($dateAndStage) {
                    list($date, $stage) = $dateAndStage;
                    $params['Versioned.mode'] = 'archive';
                    $params['Versioned.date'] = $date;
                    $params['Versioned.stage'] = $stage;
                } else {
                    // Fallback to default
                    $params['Versioned.mode'] = 'stage';
                    $params['Versioned.stage'] = static::DRAFT;
                }
                break;
            }
        }
    }
public function updateInheritableQueryParams(&$params)
    {
        // Skip if versioned isn't set
        if (!isset($params['Versioned.mode'])) {
            return;
        }

        // Adjust query based on original selection criterea
        switch ($params['Versioned.mode']) {
            case 'all_versions':
            {
                // Versioned.mode === all_versions doesn't inherit very well, so default to stage
                $params['Versioned.mode'] = 'stage';
                $params['Versioned.stage'] = static::DRAFT;
                break;
            }
            case 'version':
            {
                // If we selected this object from a specific version, we need
                // to find the date this version was published, and ensure
                // inherited queries select from that date.
                $version = $params['Versioned.version'];
                $dateAndStage = $this->getLastEditedAndStageForVersion($version);

                // Filter related objects at the same date as this version
                unset($params['Versioned.version']);
                if ($dateAndStage) {
                    list($date, $stage) = $dateAndStage;
                    $params['Versioned.mode'] = 'archive';
                    $params['Versioned.date'] = $date;
                    $params['Versioned.stage'] = $stage;
                } else {
                    // Fallback to default
                    $params['Versioned.mode'] = 'stage';
                    $params['Versioned.stage'] = static::DRAFT;
                }
                break;
            }
        }
    }
public function updateInheritableQueryParams ( & $ params ) { // Skip if versioned isn't set if ( ! isset ( $ params [ 'Versioned.mode' ] ) ) { return ; } // Adjust query based on original selection criterea switch ( $ params [ 'Versioned.mode' ] ) { case 'all_versions' : { // Versioned.mode === all_versions doesn't inherit very well, so default to stage $ params [ 'Versioned.mode' ] = 'stage' ; $ params [ 'Versioned.stage' ] = static :: DRAFT ; break ; } case 'version' : { // If we selected this object from a specific version, we need // to find the date this version was published, and ensure // inherited queries select from that date. $ version = $ params [ 'Versioned.version' ] ; $ dateAndStage = $ this -> getLastEditedAndStageForVersion ( $ version ) ; // Filter related objects at the same date as this version unset ( $ params [ 'Versioned.version' ] ) ; if ( $ dateAndStage ) { list ( $ date , $ stage ) = $ dateAndStage ; $ params [ 'Versioned.mode' ] = 'archive' ; $ params [ 'Versioned.date' ] = $ date ; $ params [ 'Versioned.stage' ] = $ stage ; } else { // Fallback to default $ params [ 'Versioned.mode' ] = 'stage' ; $ params [ 'Versioned.stage' ] = static :: DRAFT ; } break ; } } }
Updates query parameters of relations attached to versioned dataobjects

@param array $params
Updates query parameters of relations attached to versioned dataobjects