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