Skip to content

Commit

Permalink
fix: traits cant have arrays as default
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyTWF committed Oct 9, 2023
1 parent 8cf81d0 commit 0096424
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 22 deletions.
48 changes: 30 additions & 18 deletions app/Allocator/Stand/OrdersStandsByCommonConditions.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,37 @@ trait OrdersStandsByCommonConditions
private string $otherStandRequests = 'other_stand_requests.id ASC';
private string $random = 'RAND() ASC';

private array $commonOrderByConditions = [
$this->aerodromeReferenceCode,
$this->assignmentPriority,
$this->otherStandRequests,
$this->random,
];
private function commonOrderByConditions(): array
{
return [
$this->aerodromeReferenceCode,
$this->assignmentPriority,
$this->otherStandRequests,
$this->random,
];
}

private array $commonOrderByConditionsWithoutAssignmentPriority = [
$this->aerodromeReferenceCode,
$this->otherStandRequests,
$this->random,
];
private function commonOrderByConditionsWithoutAssignmentPriority(): array
{
return [
$this->aerodromeReferenceCode,
$this->otherStandRequests,
$this->random,
];
}

private array $commonOrderByConditionsForRanking = [
$this->aerodromeReferenceCode,
$this->assignmentPriority,
];
private function commonOrderByConditionsForRanking(): array
{
return [
$this->aerodromeReferenceCode,
$this->assignmentPriority,
];
}

private array $commonOrderByConditionsWithoutAssignmentPriorityForRanking = [
$this->aerodromeReferenceCode,
];
private function commonOrderByConditionsWithoutAssignmentPriorityForRanking(): array
{
return [
$this->aerodromeReferenceCode,
];
}
}
8 changes: 4 additions & 4 deletions app/Allocator/Stand/SelectsStandsUsingStandardConditions.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ private function orderByForStandsQuery(array $customOrders, bool $includeAssignm
*/
if ($includeAssignmentPriority) {
$commonConditions = $isRanking
? $this->commonOrderByConditionsForRanking
: $this->commonOrderByConditions;
? $this->commonOrderByConditionsForRanking()
: $this->commonOrderByConditions();
} else {
$commonConditions = $isRanking
? $this->commonOrderByConditionsWithoutAssignmentPriorityForRanking
: $this->commonOrderByConditionsWithoutAssignmentPriority;
? $this->commonOrderByConditionsWithoutAssignmentPriorityForRanking()
: $this->commonOrderByConditionsWithoutAssignmentPriority();
}

return array_merge(
Expand Down

0 comments on commit 0096424

Please sign in to comment.