<?php
class TestPlan extends AppModel
{
var $name = 'TestPlan';
var $validate = array(
'name' => VALID_NOT_EMPTY
);
/* var $hasMany = array('TestItems' => array( 'className' => 'TestItem' ),
'TestSessions' => array( 'className' => 'TestSession' ));*/
var $hasMany = array('TestItems' => array( 'className' => 'TestItem' ));
var $belongsTo = array('Projects' => array('className'=>'Project'));
function getAll()
{
$data = $this->findAll(null,'name,modified, active','active desc, modified desc',null,null,0);
foreach($data as $num => $row)
{
$id = $row['TestPlan']['id'];
$testitems = $this->query("select count(*) as count from sp_test_items where test_plan_id = $id");
$data[$num]['TestPlan']['count'] = $testitems[0][0]['count'];
}
return $data;
}
function fetchTestPlan($id)
{
$this->recursive = 1;
$data = $this->findById($id);
return $data;
}
}
?>