Location: PHPKode > projects > Nella Framework > nella-framework-7e780c6/Nella/NetteAddons/Media/Model/FileDao.php
<?php
/**
 * This file is part of the Nella Framework (http://nellafw.org).
 *
 * Copyright (c) 2006, 2012 Patrik Votoček (http://patrik.votocek.cz)
 *
 * For the full copyright and license information, please view the file LICENSE.txt that was distributed with this source code.
 */

namespace Nella\NetteAddons\Media\Model;

/**
 * File dao
 *
 * @author	Patrik Votoček
 */
class FileDao extends \Nette\Object implements IFileDao
{
	/**
	 * @param string
	 * @return \Nella\NetteAddons\Media\File|NULL
	 */
	public function findOneByFullSlug($slug)
	{
		if (($pos = strrpos($slug, '_')) === FALSE) {
			return NULL;
		}

		$path = substr_replace($slug, '.', $pos, 1);

		try {
			return new File($path);
		} catch (\Nette\InvalidArgumentException $e) {
			return NULL;
		}
	}
}
Return current item: Nella Framework