core-bundle/src/Resources/contao/library/Contao/Model.php
public static function findByIdOrAlias($varId, array $arrOptions=array())
	{
		$isAlias = !preg_match('/^[1-9]\d*$/', $varId);

		// Try to load from the registry
		if (!$isAlias && empty($arrOptions))
		{
			$objModel = Registry::getInstance()->fetch(static::$strTable, $varId);

			if ($objModel !== null)
			{
				return $objModel;
			}
		}

		$t = static::$strTable;

		$arrOptions = array_merge
		(
			array
			(
				'limit'  => 1,
				'column' => $isAlias ? array("$t.alias=?") : array("$t.id=?"),
				'value'  => $varId,
				'return' => 'Model'
			),

			$arrOptions
		);

		return static::find($arrOptions);
	}
public static function findByIdOrAlias($varId, array $arrOptions=array())
	{
		$isAlias = !preg_match('/^[1-9]\d*$/', $varId);

		// Try to load from the registry
		if (!$isAlias && empty($arrOptions))
		{
			$objModel = Registry::getInstance()->fetch(static::$strTable, $varId);

			if ($objModel !== null)
			{
				return $objModel;
			}
		}

		$t = static::$strTable;

		$arrOptions = array_merge
		(
			array
			(
				'limit'  => 1,
				'column' => $isAlias ? array("$t.alias=?") : array("$t.id=?"),
				'value'  => $varId,
				'return' => 'Model'
			),

			$arrOptions
		);

		return static::find($arrOptions);
	}
Find a single record by its ID or alias

@param mixed $varId      The ID or alias
@param array $arrOptions An optional options array

@return static The model or null if the result is empty