core-bundle/src/Resources/contao/library/Contao/Model/Registry.php
public function fetch($strTable, $varKey, $strAlias=null)
	{
		/** @var Model $strClass */
		$strClass = Model::getClassFromTable($strTable);
		$strPk = $strClass::getPk();

		// Search by PK (most common case)
		if ($strAlias === null || $strAlias == $strPk)
		{
			if (isset($this->arrRegistry[$strTable][$varKey]))
			{
				return $this->arrRegistry[$strTable][$varKey];
			}

			return null;
		}

		// Try to find the model by one of its aliases
		return $this->fetchByAlias($strTable, $strAlias, $varKey);
	}
public function fetch($strTable, $varKey, $strAlias=null)
	{
		/** @var Model $strClass */
		$strClass = Model::getClassFromTable($strTable);
		$strPk = $strClass::getPk();

		// Search by PK (most common case)
		if ($strAlias === null || $strAlias == $strPk)
		{
			if (isset($this->arrRegistry[$strTable][$varKey]))
			{
				return $this->arrRegistry[$strTable][$varKey];
			}

			return null;
		}

		// Try to find the model by one of its aliases
		return $this->fetchByAlias($strTable, $strAlias, $varKey);
	}
Fetch a model by table name and primary key

@param string $strTable The table name
@param mixed  $varKey   The key
@param string $strAlias An optional alias

@return Model|null The model or null