Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
class CategoryDao extends BaseDao
4
{
5
	function addNewCategory($category)
6
	{
7
		$sqlmap = $this->getSqlMap();
8
		$exists = $this->getCategoryByNameInProject(
9
			$category->Name, $category->ProjectID);
10
		if(!$exists)
11
			$sqlmap->insert('AddNewCategory', $category);
12
	}
13
 
14
	function getCategoryByID($categoryID)
15
	{
16
		$sqlmap = $this->getSqlMap();
17
		return $sqlmap->queryForObject('GetCategoryByID', $categoryID);
18
	}
19
 
20
	function getAllCategories()
21
	{
22
		$sqlmap = $this->getSqlMap();
23
		return $sqlmap->queryForList('GetAllCategories');
24
	}
25
 
26
	function deleteCategory($categoryID)
27
	{
28
		$sqlmap = $this->getSqlMap();
29
		$sqlmap->delete('DeleteCategory', $categoryID);
30
	}
31
 
32
	function getCategoriesByProjectID($projectID)
33
	{
34
		$sqlmap = $this->getSqlMap();
35
		return $sqlmap->queryForList('GetCategoriesByProjectID', $projectID);
36
	}
37
 
38
	function getCategoryByNameInProject($name, $projectID)
39
	{
40
		$sqlmap = $this->getSqlMap();
41
		$param['project'] = $projectID;
42
		$param['category'] = $name;
43
		return $sqlmap->queryForObject('GetCategoryByNameInProject', $param);
44
	}
45
 
46
	function updateCategory($category)
47
	{
48
		$sqlmap = $this->getSqlMap();
49
		$sqlmap->update('UpdateCategory', $category);
50
	}
51
}
52
 
53
?>