yii\elasticsearch\Query::createCommand PHP 메소드

createCommand() 공개 메소드

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.
리턴 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
 /**
  * @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