/** * Prevents invalid calls to the site respository in case the site data property is not available. * * @return null|object */ protected function getCurrentSite() { if (!isset($this->data['site']) || $this->data['site'] === null) { return null; } return $this->siteRepository->findByIdentifier($this->data['site']); }