feat: Rework task management in PlanBundle
- Introduced migration Version_0_13_0 to update task schema: - Changed start_date and end_date to DATE type, truncating time. - Added new columns: task_kind, definition_of_done, planned_work. - Removed parent_id and its index, replacing with a dependency graph. - Created new tables: plan_task_dependencies and plan_task_raci, including a join table for stakeholders. - Updated Version_0_4_0 migration to remove references to parent_id. - Refactored TaskModel to return tasks as flat rows with dependencies and RACI assignments. - Modified task table view to display tasks without hierarchical structure, adding badges for milestones and phases. - Enhanced task form to include dependencies and RACI roles, with appropriate macros for rendering. - Updated task list view to reflect new task structure and display status based on task kind. - Added new validation constraints for task dependencies and dates, ensuring no cycles or self-references. - Removed obsolete ValidTaskParent validation as parent-child relationships are no longer supported. - Updated translations to reflect changes in task management and new fields. - Revised documentation to describe new task handling and features.
This commit is contained in:
1 parent
8696acd01c
commit
8268fad886
33 files changed
+1454
-251
No files matched your search
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MauticPlugin\PlanBundle\Entity;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata;
|
||||
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
|
||||
|
||||
/**
|
||||
* One dependency edge of the task dependency graph: this task depends on the depends-on task, with
|
||||
* the relation type End2Start, End2End, Start2Start or Start2End.
|
||||
*
|
||||
* The edge is owned by the task it belongs to (Task::$dependencies); deleting either task deletes
|
||||
* the edge (ON DELETE CASCADE both sides).
|
||||
*/
|
||||
class TaskDependency
|
||||
{
|
||||
public const TABLE_NAME = 'plan_task_dependencies';
|
||||
|
||||
private ?int $id = null;
|
||||
|
||||
private ?Task $task = null;
|
||||
|
||||
private ?Task $dependsOn = null;
|
||||
|
||||
private DependencyType $dependencyType = DependencyType::EndToStart;
|
||||
|
||||
/**
|
||||
* Display order within the task's dependency list, from 0.
|
||||
*/
|
||||
private int $position = 0;
|
||||
|
||||
public static function loadMetadata(OrmClassMetadata $metadata): void
|
||||
{
|
||||
$builder = new ClassMetadataBuilder($metadata);
|
||||
|
||||
$builder->setTable(self::TABLE_NAME)
|
||||
->setCustomRepositoryClass(TaskDependencyRepository::class);
|
||||
|
||||
$builder->addId();
|
||||
|
||||
$builder->createManyToOne('task', Task::class)
|
||||
->inversedBy('dependencies')
|
||||
->addJoinColumn('task_id', 'id', false, false, 'CASCADE')
|
||||
->build();
|
||||
|
||||
$builder->createManyToOne('dependsOn', Task::class)
|
||||
->addJoinColumn('depends_on_id', 'id', false, false, 'CASCADE')
|
||||
->build();
|
||||
|
||||
$metadata->mapField([
|
||||
'fieldName' => 'dependencyType',
|
||||
'columnName' => 'dependency_type',
|
||||
'type' => Types::STRING,
|
||||
'length' => 20,
|
||||
'enumType' => DependencyType::class,
|
||||
'options' => ['default' => DependencyType::EndToStart->value],
|
||||
]);
|
||||
|
||||
$builder->createField('position', Types::INTEGER)
|
||||
->option('default', 0)
|
||||
->build();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getTask(): ?Task
|
||||
{
|
||||
return $this->task;
|
||||
}
|
||||
|
||||
public function setTask(?Task $task): static
|
||||
{
|
||||
$this->task = $task;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDependsOn(): ?Task
|
||||
{
|
||||
return $this->dependsOn;
|
||||
}
|
||||
|
||||
public function setDependsOn(?Task $dependsOn): static
|
||||
{
|
||||
$this->dependsOn = $dependsOn;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDependencyType(): DependencyType
|
||||
{
|
||||
return $this->dependencyType;
|
||||
}
|
||||
|
||||
public function setDependencyType(DependencyType $dependencyType): static
|
||||
{
|
||||
$this->dependencyType = $dependencyType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPosition(): int
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function setPosition(?int $position): static
|
||||
{
|
||||
$this->position = $position ?? 0;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user