src/Versioned.php
public function augmentLoadLazyFields(SQLSelect &$query, DataQuery &$dataQuery = null, $dataObject)
    {
        // The VersionedMode local variable ensures that this decorator only applies to
        // queries that have originated from the Versioned object, and have the Versioned
        // metadata set on the query object. This prevents regular queries from
        // accidentally querying the *_Versions tables.
        $versionedMode = $dataObject->getSourceQueryParam('Versioned.mode');
        $modesToAllowVersioning = ['all_versions', 'latest_versions', 'archive', 'version'];
        if (!empty($dataObject->Version) &&
            (!empty($versionedMode) && in_array($versionedMode, $modesToAllowVersioning))
        ) {
            // This will ensure that augmentSQL will select only the same version as the owner,
            // regardless of how this object was initially selected
            $versionColumn = $this->owner->getSchema()->sqlColumnForField($this->owner, 'Version');
            $dataQuery->where([
                $versionColumn => $dataObject->Version
            ]);
            $dataQuery->setQueryParam('Versioned.mode', 'all_versions');
        }
    }
public function augmentLoadLazyFields(SQLSelect &$query, DataQuery &$dataQuery = null, $dataObject)
    {
        // The VersionedMode local variable ensures that this decorator only applies to
        // queries that have originated from the Versioned object, and have the Versioned
        // metadata set on the query object. This prevents regular queries from
        // accidentally querying the *_Versions tables.
        $versionedMode = $dataObject->getSourceQueryParam('Versioned.mode');
        $modesToAllowVersioning = ['all_versions', 'latest_versions', 'archive', 'version'];
        if (!empty($dataObject->Version) &&
            (!empty($versionedMode) && in_array($versionedMode, $modesToAllowVersioning))
        ) {
            // This will ensure that augmentSQL will select only the same version as the owner,
            // regardless of how this object was initially selected
            $versionColumn = $this->owner->getSchema()->sqlColumnForField($this->owner, 'Version');
            $dataQuery->where([
                $versionColumn => $dataObject->Version
            ]);
            $dataQuery->setQueryParam('Versioned.mode', 'all_versions');
        }
    }
public function augmentLoadLazyFields ( SQLSelect & $ query , DataQuery & $ dataQuery = null , $ dataObject ) { // The VersionedMode local variable ensures that this decorator only applies to // queries that have originated from the Versioned object, and have the Versioned // metadata set on the query object. This prevents regular queries from // accidentally querying the *_Versions tables. $ versionedMode = $ dataObject -> getSourceQueryParam ( 'Versioned.mode' ) ; $ modesToAllowVersioning = [ 'all_versions' , 'latest_versions' , 'archive' , 'version' ] ; if ( ! empty ( $ dataObject -> Version ) && ( ! empty ( $ versionedMode ) && in_array ( $ versionedMode , $ modesToAllowVersioning ) ) ) { // This will ensure that augmentSQL will select only the same version as the owner, // regardless of how this object was initially selected $ versionColumn = $ this -> owner -> getSchema ( ) -> sqlColumnForField ( $ this -> owner , 'Version' ) ; $ dataQuery -> where ( [ $ versionColumn => $ dataObject -> Version ] ) ; $ dataQuery -> setQueryParam ( 'Versioned.mode' , 'all_versions' ) ; } }
For lazy loaded fields requiring extra sql manipulation, ie versioning.

@param SQLSelect $query
@param DataQuery $dataQuery
@param DataObject $dataObject
For lazy loaded fields requiring extra sql manipulation ie versioning .