Merge pull request #504 from creative-commoners/pulls/2/depr

API Deprecate passing multiple IDs
This commit is contained in:
Guy Sartorelli 2023-01-26 14:01:22 +13:00 committed by GitHub
commit 7d8909ac6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ namespace SilverStripe\Subsites\State;
use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Resettable; use SilverStripe\Core\Resettable;
use SilverStripe\Dev\Deprecation;
/** /**
* SubsiteState provides static access to the current state for subsite related data during a request * SubsiteState provides static access to the current state for subsite related data during a request
@ -48,6 +49,9 @@ class SubsiteState implements Resettable
*/ */
public function setSubsiteId($id) public function setSubsiteId($id)
{ {
if (!ctype_digit((string) $id) && !is_null($id)) {
Deprecation::notice('2.8.0', 'Passing multiple IDs is deprecated, only pass a single ID instead.');
}
if (is_null($this->originalSubsiteId)) { if (is_null($this->originalSubsiteId)) {
$this->originalSubsiteId = (int) $id; $this->originalSubsiteId = (int) $id;
} }