yii\elasticsearch\Query::init PHP Method

init() public method

public init ( )
    public function init()
    {
        parent::init();
        // setting the default limit according to elasticsearch defaults
        // http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#_parameters_5
        if ($this->limit === null) {
            $this->limit = 10;
        }
    }

Usage Example

 /**
  * Initializes the object.
  * This method is called at the end of the constructor. The default implementation will trigger
  * an [[EVENT_INIT]] event. If you override this method, make sure you call the parent implementation at the end
  * to ensure triggering of the event.
  */
 public function init()
 {
     parent::init();
     $this->trigger(self::EVENT_INIT);
 }