src/Relationship/HasManyRelationship.php
public function get()
    {
        $child = $this->childClassName;
        $query = new QueryBuilder();
        $query->filter(new ParentFilter($this->parent->getId()));
        $collection = $child::search($query);
        $collection->each(function (ElasticsearchModel $model) {
            $model->setParent($this->parent);
        });
        return $collection;
    }
public function get()
    {
        $child = $this->childClassName;
        $query = new QueryBuilder();
        $query->filter(new ParentFilter($this->parent->getId()));
        $collection = $child::search($query);
        $collection->each(function (ElasticsearchModel $model) {
            $model->setParent($this->parent);
        });
        return $collection;
    }
public function get ( ) { $ child = $ this -> childClassName ; $ query = new QueryBuilder ( ) ; $ query -> filter ( new ParentFilter ( $ this -> parent -> getId ( ) ) ) ; $ collection = $ child :: search ( $ query ) ; $ collection -> each ( function ( ElasticsearchModel $ model ) { $ model -> setParent ( $ this -> parent ) ; } ) ; return $ collection ; }
Find all children.

@return ElasticsearchCollection|ElasticsearchModel[]
Find all children .