public function fetchRelation(array $fields = array())
 {
     $requestAction = Requests::getRelationships($this->module->getModuleName(), $this->module->id, $this->relation->getDbName(), $this->relation->getModuleName(), $fields);
     $results = Request::call($requestAction);
     if ($this->relation->isCollection()) {
         return Converter::toModules($results, $this->relationModule);
     }
     return Converter::toModule($results->entry_list[0], $this->relationModule);
 }
Ejemplo n.º 2
0
 public function fetchAll()
 {
     $results = $this->doFetchRequest();
     $modules = Converter::toModules($results, $this->module);
     foreach ($this->joinClauses as $join) {
         $modules = Arrays::map($modules, function (Module $module) use($join) {
             $module->fetchRelation($join->getRelationName(), $join->getRelationFields());
             return $module;
         });
     }
     return $modules;
 }