/** * Count all incomplete tasks from this project AND its children */ public function countContainedTasks($complete = null, $user = null) { $ids = array($this->id); $ids = array_merge($ids, $this->getChildIds(true, 1)); $where = array('projectid' => $ids); if ($complete !== null) { $where['complete='] = $complete; } return $this->projectService->getTaskCount($where); }