core-bundle/src/Resources/contao/models/FilesModel.php
public static function findByPath($path, array $arrOptions=array())
	{
		$rootDir = System::getContainer()->getParameter('kernel.project_dir');

		if (strncmp($path, $rootDir . '/', \strlen($rootDir) + 1) === 0)
		{
			$path = substr($path, \strlen($rootDir) + 1);
		}

		return static::findOneBy('path', $path, $arrOptions);
	}
public static function findByPath($path, array $arrOptions=array())
	{
		$rootDir = System::getContainer()->getParameter('kernel.project_dir');

		if (strncmp($path, $rootDir . '/', \strlen($rootDir) + 1) === 0)
		{
			$path = substr($path, \strlen($rootDir) + 1);
		}

		return static::findOneBy('path', $path, $arrOptions);
	}
Find a file by its path

@param string $path       The path
@param array  $arrOptions An optional options array

@return FilesModel|null The model or null if there is no file