/** * @param CustomResult $customResult * * @throws \Exception */ public function setCustomResult(CustomResult $customResult) { $this->checksForCustomObject(); if (count($this->responseBody->getMembers()) > 0) { throw new \Exception(self::ERROR_CANNOT_USE_CUSTOM_AND_OTHER_RESOURCES); } $this->responseBody->addMember($customResult->getSerializer()); $this->isCustom = true; }