public function exists($db = null)
    {
        if ($this->emulateExecution) {
            return reject(false);
        }
        $command = $this->createCommand($db);
        $params = $command->params;
        $command->setSql($command->db->getQueryBuilder()->selectExists($command->getSql()));
        $command->bindValues($params);
        return $command->queryScalar()
            ->thenLazy(function($count = 0) {
                return $count > 0 ? true : reject(new Error("Does not exist"));
            });
    }
public function exists($db = null)
    {
        if ($this->emulateExecution) {
            return reject(false);
        }
        $command = $this->createCommand($db);
        $params = $command->params;
        $command->setSql($command->db->getQueryBuilder()->selectExists($command->getSql()));
        $command->bindValues($params);
        return $command->queryScalar()
            ->thenLazy(function($count = 0) {
                return $count > 0 ? true : reject(new Error("Does not exist"));
            });
    }
public function exists ( $ db = null ) { if ( $ this -> emulateExecution ) { return reject ( false ) ; } $ command = $ this -> createCommand ( $ db ) ; $ params = $ command -> params ; $ command -> setSql ( $ command -> db -> getQueryBuilder ( ) -> selectExists ( $ command -> getSql ( ) ) ) ; $ command -> bindValues ( $ params ) ; return $ command -> queryScalar ( ) -> thenLazy ( function ( $ count = 0 ) { return $ count > 0 ? true : reject ( new Error ( "Does not exist" ) ) ; } ) ; }
Returns a value indicating whether the query result contains any row of data.
@param DatabaseInterface|DbConnectionGetterInterface $db the database connection used to generate the SQL statement.
If this parameter is not given, the `db` application component will be used.
@return ExtendedPromiseInterface with bool whether the query result contains any row of data.
Returns a value indicating whether the query result contains any row of data .