Adldap\Query\Builder::findOrFail PHP Method

findOrFail() public method

Finds a record using ambiguous name resolution. If a record is not found, an exception is thrown.
public findOrFail ( string $anr, array | string $columns = [] ) : mixed
$anr string
$columns array | string
return mixed
    public function findOrFail($anr, $columns = [])
    {
        $entry = $this->find($anr, $columns);
        // Make sure we check if the result is an entry or an array before
        // we throw an exception in case the user wants raw results.
        if (!$entry instanceof Model && !is_array($entry)) {
            throw (new ModelNotFoundException())->setQuery($this->getUnescapedQuery(), $this->getDn());
        }
        return $entry;
    }