<?php
/**
 * @copyright  2009-2011 Roberto Perpuly
 *
 * This source may not be redistributed without prior consent.  Access to the 
 * source does not imply that you have consent to redistribute either this source
 * code or the generated binary. See LICENSE file for details.
 */


/**
 * Triumph_FileItem class represents a single file name (full path) that was
 * found by Triumph.  
 *
 * Triumph creates a database of resources; this source code file can be 
 * used to get items from it.
 */
class Triumph_FileItemTable extends Zend_Db_Table_Abstract {

	protected $_name = 'file_tags';
	
	/**
	 * @param $pdo the connection to the resource database
	 * @param $startingPath the path to query
	 * @return Triumph_FileItem[] all files whose full path starts with $startingPath 
	 */
	public function MatchingFiles($startingPath) {
		$startingPath .= '%';
		
		$select = $this->select();
		$select->where('full_path LIKE ?', $startingPath);
		$stmt = $select->query();
		
		return $stmt->fetchAll(Zend_Db::FETCH_OBJ);
	}
}