mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
Merge pull request #340 from creative-commoners/pulls/4.0/fix-broken-builds
FIX Check type is number before pass to setSubsiteId method
This commit is contained in:
commit
2f56d944c6
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\FullTextSearch\Search\Variants;
|
namespace SilverStripe\FullTextSearch\Search\Variants;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
use SilverStripe\Assets\File;
|
use SilverStripe\Assets\File;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\FullTextSearch\Search\Indexes\SearchIndex;
|
use SilverStripe\FullTextSearch\Search\Indexes\SearchIndex;
|
||||||
@ -71,6 +72,12 @@ class SearchVariantSubsites extends SearchVariant
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_numeric($state)) {
|
||||||
|
$state = (int) $state;
|
||||||
|
} else {
|
||||||
|
throw new InvalidArgumentException("Invalid state ID. State ID should be number.");
|
||||||
|
}
|
||||||
|
|
||||||
// Note: Setting directly to the SubsiteState because we don't want the subsite ID to be persisted
|
// Note: Setting directly to the SubsiteState because we don't want the subsite ID to be persisted
|
||||||
// like Subsite::changeSubsite would do.
|
// like Subsite::changeSubsite would do.
|
||||||
SubsiteState::singleton()->setSubsiteId($state);
|
SubsiteState::singleton()->setSubsiteId($state);
|
||||||
|
Loading…
Reference in New Issue
Block a user