Example #1
0
 /**
  * {@inheritdoc}
  */
 public function resolve(array $entities, QueryBuilder $query)
 {
     $this->initRelation($entities, []);
     if (!($keys = $this->getKeys($entities))) {
         return;
     }
     if ($this->orderBy) {
         foreach ($this->orderBy as $column => $order) {
             $query->orderBy($column, $order);
         }
     }
     $targets = $query->whereIn($this->keyTo, $keys)->get();
     $this->map($entities, $targets);
     $this->mapBelongsTo($entities);
     $this->resolveRelations($query, $targets);
 }