Skip to content

Commit

Permalink
Fix QueryModificationTrait parameter types and default values
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Sep 12, 2025
1 parent 1f4ac6c commit 3e89c28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
8 changes: 3 additions & 5 deletions app/src/Controller/Component/BreadcrumbComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,9 @@ public function injectPrimaryLink(object $link, bool $index=true, string $linkLa
$linkAttr = $link->attr == $modelNameForeignKey ? 'id' : $link->attr;
$linkObj = $linkTable
->find()
->where(["$modelAlias.$linkAttr" => $link->value]);
if ($contain !== null) {
$linkObj = $linkObj->contain($contain);
}
$linkObj = $linkObj->firstOrFail();
->where(["$modelAlias.$linkAttr" => $link->value])
->contain($contain)
->firstOrFail();

if($index) {
// We need to determine the primary link of the parent, which might or might
Expand Down
24 changes: 12 additions & 12 deletions app/src/Lib/Traits/QueryModificationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,25 @@

trait QueryModificationTrait {
// Array of associated models to copy during a duplicate
private $duplicateContains = false;
private array $duplicateContains = [];

// Array of associated models to pull during an edit
private $editContains = false;
private array $editContains = [];

// Containable models for index actions
private $indexContains = null;
private array $indexContains = [];

// Filter (where clause) for index actions
private $indexFilter = null;
private array $indexFilter = [];

// Array of associated models to save during a patch
private $patchAssociated = [];
private array $patchAssociated = [];

// Array of associated models to pull during a view
private $viewContains = false;
private array $viewContains = [];

// Array of associated models to pull during a pick action
private $pickerContains = false;
private array $pickerContains = [];


/**
Expand Down Expand Up @@ -88,7 +88,7 @@ public function checkValidity(Query $query): QueryExpression {
* @return array Array of associated models
*/

public function getDuplicateContains() {
public function getDuplicateContains(): array {
return $this->duplicateContains;
}

Expand All @@ -99,7 +99,7 @@ public function getDuplicateContains() {
* @return array Array of associated models
*/

public function getEditContains() {
public function getEditContains(): array {
return $this->editContains;
}

Expand All @@ -110,7 +110,7 @@ public function getEditContains() {
* @param boolean $allowEmpty true if the primary link is permitted to be empty
*/

public function getIndexContains() {
public function getIndexContains(): array {
return $this->indexContains;
}

Expand All @@ -132,7 +132,7 @@ public function getPatchAssociated() {
* @return array Array of associated models
*/

public function getPickerContains() {
public function getPickerContains(): array {
return $this->pickerContains;
}

Expand All @@ -143,7 +143,7 @@ public function getPickerContains() {
* @return array Array of associated models
*/

public function getViewContains() {
public function getViewContains(): array {
return $this->viewContains;
}

Expand Down

0 comments on commit 3e89c28

Please sign in to comment.