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; } }