Retrieve the current active version for a row.

@param mixed $mixID The ID of the row.

@return mixed The current version number of the requested row.
166294
public function getActiveVersion($mixID)
    {
        $queryBuilder = $this->connection->createQueryBuilder();
        $queryBuilder->select(['select']);
        $queryBuilder->from('tl_version');
        $queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.pid', ':pid'));
        $queryBuilder->setParameter(':pid', $mixID);
        $queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.fromTable', ':fromTable'));
        $queryBuilder->setParameter(':fromTable', $this->source);
        $queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.active', ':active'));
        $queryBuilder->setParameter(':active', 1);

        $statement = $queryBuilder->execute();
        if (0 === $statement->rowCount()) {
            return null;
        }

        return $statement->fetch(\PDO::FETCH_OBJ)->version;
    }
468017
public function getRevisionById($revisionId)
    {
        $revision = $this->revisions->get($revisionId);

        if ($revision !== null) {
            return $revision; //We get here when rendering an unpublished page version
        }

        foreach ($this->revisions as $revision) {
            if ($revision->getRevisionId() === $revisionId) {
                return $revision; //We get here when publishing a new page version
            }
        }

        return null;
    }
618565
protected function getStatus($statusId)
    {
        if (!isset($this->cachedStatuses[$statusId])) {
            $this->cachedStatuses[$statusId] = $this->statusRepository->findOneById($statusId);
        }

        return $this->cachedStatuses[$statusId];
    }
1147610
public function apply($contentId)
    {
        $versionNumbers = $this->contentGateway->listVersionNumbers($contentId);
        $fieldIdSet = array();

        $nameRows = $this->contentGateway->loadVersionedNameData(
            array_map(
                function ($versionNo) use ($contentId) {
                    return array('id' => $contentId, 'version' => $versionNo);
                },
                $versionNumbers
            )
        );

        foreach ($versionNumbers as $versionNo) {
            $contentRows = $this->contentGateway->load($contentId, $versionNo);
            $contentList = $this->contentMapper->extractContentFromRows($contentRows, $nameRows);
            $content = $contentList[0];
            $versionFieldIdSet = array();

            foreach ($content->fields as $field) {
                if ($field->fieldDefinitionId == $this->fieldDefinition->id) {
                    $fieldIdSet[$field->id] = true;
                    $versionFieldIdSet[$field->id] = true;
                }
            }

            // Delete from external storage with list of IDs per version
            $this->storageHandler->deleteFieldData(
                $this->fieldDefinition->fieldType,
                $content->versionInfo,
                array_keys($versionFieldIdSet)
            );
        }

        // Delete from internal storage -- field is always deleted from _all_ versions
        foreach (array_keys($fieldIdSet) as $fieldId) {
            $this->contentGateway->deleteField($fieldId);
        }
    }
1054391
public function getActiveSiteTheme($siteId)
    {
        $qb = $this->getEntityManager()->createQueryBuilder();
        /** @var $query \Doctrine\ORM\Query */

        $query = $qb->select('e, t')
            ->from($this->_entity, 'e')
            ->innerJoin('e.themeId', 't')
            ->where('e.siteId = :id')
            ->andWhere('e.isActive = 1')
            ->setMaxResults(1)
            ->setParameter('id', $siteId)
            ->getQuery();

        /** @var $result \PageBuilder\Entity\Join\SiteTheme */
        $result = $query->getOneOrNullResult(AbstractQuery::HYDRATE_OBJECT);
        if ($result) {
            return $result->getThemeId();
        } else {
            return $result;
        }
    }
879604
public static function getVersion(IRI $coid) {
    if (self::getType($coid)==self::COID_VERSIONED) {
      $segments = explode('/', $coid->getPath());
      return $segments[2];
    } else
      return null;
  }
270942
public function setVersionActive($mixID, $mixVersion)
    {
        $updateValues = ['tl_version.pid' => $mixID, 'tl_version.fromTable' => $this->source];

        // Set version inactive.
        $this->connection->update('tl_version', ['tl_version.active' => ''], $updateValues);

        // Set version active.
        $updateValues['version'] = $mixVersion;
        $this->connection->update('tl_version', ['tl_version.active' => 1], $updateValues);
    }
1050498
function GetLastInsertId()
	{
		$id = null;
		
		if ($this->ConnectionSetting->IsReadOnlySlave && $this->_masterAdapter) {
			$id = $this->_masterAdapter->GetLastInsertId();
		}
		else {
			$this->RequireConnection();
			$this->Observe("DataAdapter ($this->_label) GetLastInsertId", OBSERVE_QUERY);
			$id = $this->_driver->GetLastInsertId($this->_dbconn);
		}
		
		return $id;
	}
843825
public function deleteVersionById(string $modelId, string $versionId)
    {
        $deleteResult = $this->getRequest()->request(
            'DELETE',
            $this->getRequestUrl(sprintf('models/%s/versions/%s', $modelId, $versionId))
        );

        return $deleteResult['status'];
    }
68617
public function getProduct($id, $combinationId = null)
    {
        $product = null;

        if ($this->isContainsProduct($id, $combinationId)) {
            $product = Product::findOne($id);
        };

        return $product;
    }
577400
public function setActive($id)
	{
		if (isset($this->_items[$id]))
		{
			$this->_active = $id;

			$result =& $this->_items[$id];

			return $result;
		}

		return null;
	}
1323746
public static function make_current($versionid) {
        global $DB, $USER;

        $policyversion = new policy_version($versionid);
        if (! $policyversion->get('id') || $policyversion->get('archived')) {
            throw new coding_exception('Version not found or is archived');
        }

        // Archive current version of this policy.
        if ($currentversionid = $DB->get_field('tool_policy', 'currentversionid', ['id' => $policyversion->get('policyid')])) {
            if ($currentversionid == $versionid) {
                // Already current, do not change anything.
                return;
            }
            $DB->set_field('tool_policy_versions', 'archived', 1, ['id' => $currentversionid]);
        }

        // Set given version as current.
        $DB->set_field('tool_policy', 'currentversionid', $policyversion->get('id'), ['id' => $policyversion->get('policyid')]);

        // Reset the policyagreed flag to force everybody re-accept the policies.
        $DB->set_field('user', 'policyagreed', 0);

        // Make sure that the current user is not immediately redirected to the policy acceptance page.
        if (isloggedin() && !isguestuser()) {
            $USER->policyagreed = 1;
        }
    }
758398
public function getComponentUpdates()
    {
        $componentsToCheck = array(
            'core' => Version::VERSION
        );

        $manager = \Piwik\Plugin\Manager::getInstance();
        $plugins = $manager->getLoadedPlugins();
        foreach ($plugins as $pluginName => $plugin) {
            if ($manager->isPluginInstalled($pluginName)) {
                $componentsToCheck[$pluginName] = $plugin->getVersion();
            }
        }

        $columnsVersions = $this->columnsUpdater->getAllVersions($this);
        foreach ($columnsVersions as $component => $version) {
            $componentsToCheck[$component] = $version;
        }

        $componentsWithUpdateFile = $this->getComponentsWithUpdateFile($componentsToCheck);

        if (count($componentsWithUpdateFile) == 0) {
            $this->columnsUpdater->onNoUpdateAvailable($columnsVersions);

            return null;
        }

        return $componentsWithUpdateFile;
    }
125711
public function listVersionNumbers($contentId)
    {
        try {
            return $this->innerGateway->listVersionNumbers($contentId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
615871
public function getMatchStatus($matchId) {
        $endpoint = vsprintf('/match/%s', $matchId);
        $requestData = $this->getDefaultRequestData('query', []);

        return $this->sendRequest($endpoint, $requestData, self::HTTP_METHOD_GET);
    }
391994
public function getActiveProvider()
    {
        if ($this->activeProvider instanceof ProviderInterface) {
            return $this->activeProvider;
        }

        if (empty($this->providers)) {
            throw new RuntimeException('No versioning provider found');
        }

        foreach ($this->providers as $entry) {
            $provider = $entry['provider'];
            /** @var $provider ProviderInterface */
            if ($provider->isSupported()) {
                $this->activeProvider = $provider;

                return $provider;
            }
        }

        throw new RuntimeException('No supported versioning providers found');
    }
534899
public function getBuilderById(string $builderId)
    {
        if (array_key_exists($builderId, $this->builders)) {
            return $this->builders[$builderId];
        }

        return;
    }