Skip to content

Commit

Permalink
Merge pull request #307 from FriendsOfCake/cake-4.2-deprecation
Browse files Browse the repository at this point in the history
Fix deprecation error on Cake 4.2.
  • Loading branch information
ADmad authored Dec 21, 2020
2 parents 64b400e + 070e8db commit 2523851
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Model/Behavior/SearchBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ public function initialize(array $config): void
return;
}

$tableMethod = method_exists($this, 'table') ? 'table' : 'getTable';

/** @psalm-var class-string<\Search\Model\Filter\FilterCollectionInterface> */
$defaultCollectionClass = sprintf(
'%s\Model\Filter\%sCollection',
Configure::read('App.namespace'),
$this->getTable()->getAlias()
$this->{$tableMethod}()->getAlias()
);
if (class_exists($defaultCollectionClass)) {
$this->_collectionClass = $defaultCollectionClass;
Expand Down

0 comments on commit 2523851

Please sign in to comment.