Model ticket link counterparts explicitly
This commit is contained in:
@@ -60,15 +60,13 @@ class TicketLinkFactory extends Factory
|
||||
->first()
|
||||
?? TicketLinkType::factory()->for($sourceTicket->project)->create([
|
||||
'label' => 'Relates to',
|
||||
'counterpart_label' => 'Relates to',
|
||||
'position' => 1,
|
||||
])
|
||||
: TicketLinkType::query()->findOrFail($ticketLink->ticket_link_type_id);
|
||||
|
||||
$sortedIds = [$sourceTicket->id, $targetTicket->id];
|
||||
sort($sortedIds);
|
||||
|
||||
$ticketLink->source_ticket_id = $sortedIds[0];
|
||||
$ticketLink->target_ticket_id = $sortedIds[1];
|
||||
$ticketLink->source_ticket_id = $sourceTicket->id;
|
||||
$ticketLink->target_ticket_id = $targetTicket->id;
|
||||
$ticketLink->ticket_link_type_id = $ticketLinkType->id;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,8 +18,11 @@ class TicketLinkTypeFactory extends Factory
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$label = fake()->unique()->words(2, true);
|
||||
|
||||
return [
|
||||
'label' => fake()->unique()->words(2, true),
|
||||
'label' => $label,
|
||||
'counterpart_label' => $label,
|
||||
'position' => 1,
|
||||
'project_id' => Project::factory(),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user