yii\elasticsearch\Query::createCommand PHP Method

createCommand() public method

Creates a DB command that can be used to execute this query.
public createCommand ( Connection $db = null ) : Command
$db Connection the database connection used to execute the query. If this parameter is not given, the `elasticsearch` application component will be used.
return Command the created DB command instance.
    public function createCommand($db = null)
    {
        if ($db === null) {
            $db = Yii::$app->get('elasticsearch');
        }
        $commandConfig = $db->getQueryBuilder()->build($this);
        return $db->createCommand($commandConfig);
    }

Usage Example

コード例 #1
0
ファイル: Query.php プロジェクト: manyoubaby123/imshop
 /**
  * @inheritdoc
  */
 public function createCommand($db = null)
 {
     $this->mapAggregations();
     $searchQuery = $this->getSearchQuery();
     if ($searchQuery) {
         $this->query = $this->mapQuery($searchQuery);
     }
     return parent::createCommand($db);
 }
All Usage Examples Of yii\elasticsearch\Query::createCommand