public function hasSubTasks() { foreach ($this->children as $task) { if ($task->hasTasks()) { return true; } } return false; }