/** * @inheritdoc */ public function relationshipNotAcceptable(ResourceIdentifierInterface $identifier, $relationshipKey = null, $error = null) { $base = $this->repository->errorWithPointer(self::RELATIONSHIP_NOT_ACCEPTABLE, $relationshipKey ? P::relationship($relationshipKey) : P::data(), ['type' => $identifier->getType(), 'id' => $identifier->getId()]); $errors = new MutableErrorCollection(); /** @var MutableErrorInterface $err */ foreach (MutableErrorCollection::cast($error ?: $base) as $err) { $add = clone $base; $errors->add($add->merge($err)); } return $errors; }