Model/src/Exceptions/UndefinedRelationException.php

22 lines
754 B
PHP

<?php
namespace Nest\Model\Exceptions;
use Throwable;
/**
* Exception thrown when a requested relation is undefined.
*/
class UndefinedRelationException extends ModelException
{
/**
* @param string $modelClass Class of the model where the relation is undefined.
* @param string $relationName Name of the undefined relation.
* @param int $code [optional] The Exception code.
* @param null|Throwable $previous [optional] The previous throwable used for the exception chaining.
*/
public function __construct(public readonly string $modelClass, public readonly string $relationName, int $code = 0, ?Throwable $previous = null)
{
parent::__construct("Undefined relation $this->relationName in $this->modelClass.", $code, $previous);
}
}