Beispiel #1
0
 /**
  * Executes the query and returns a single row of result.
  *
  * @param ConnectionInterface $connection the Sphinx connection used to generate the SQL statement.
  * If this parameter is not given, the `sphinx` application component will be used.
  * @return array|null the first row (in terms of an array) of the query result. False is returned if the query
  * results in nothing.
  */
 public function one(ConnectionInterface $connection = null)
 {
     return parent::one($connection);
 }
Beispiel #2
0
 /**
  * Executes query and returns a single row of result.
  *
  * @param ConnectionInterface $connection the DB connection used to create the DB command.
  * If null, the DB connection returned by {@see \rock\db\ActiveQueryTrait::modleClass()} will be used.
  * @return ActiveRecord|array|null a single row of query result. Depending on the setting
  * of {@see \rock\db\ActiveQueryTrait::$asArray},the query result may be either an array or an ActiveRecord object. Null will be returned
  * if the query results in nothing.
  */
 public function one(ConnectionInterface $connection = null)
 {
     // event before
     /** @var ActiveRecord $model */
     $model = new $this->modelClass();
     if (!$model->beforeFind()) {
         return null;
     }
     return parent::one($connection);
 }