src/queries/ActiveQuery.php
public function requireOne($db = null)
    {
        if (null === ($record = $this->one($db))) {
            throw new RecordNotFoundException(
                sprintf(
                    "Record not found."
                )
            );
        }

        return $record;
    }
public function requireOne($db = null)
    {
        if (null === ($record = $this->one($db))) {
            throw new RecordNotFoundException(
                sprintf(
                    "Record not found."
                )
            );
        }

        return $record;
    }
public function requireOne ( $ db = null ) { if ( null === ( $ record = $ this -> one ( $ db ) ) ) { throw new RecordNotFoundException ( sprintf ( "Record not found." ) ) ; } return $ record ; }
Executes query and returns a single result.  If a result is not found, an exception is
thrown as we explicitly expect a result.

@param Connection|null $db the DB connection used to create the DB command.
If `null`, the DB connection returned by [[modelClass]] will be used.
@return ActiveRecord|array a single row of query result. Depending on the setting of [[asArray]],
the query result may be either an array or an ActiveRecord object. `null` will be returned
if the query results in nothing.
@throws RecordNotFoundException
Executes query and returns a single result . If a result is not found an exception is thrown as we explicitly expect a result .