/** * Return values * * @param string $id * @return array */ protected function _getManyValues($id) { if (!$this->_queryBuilder) { $path = $this->_path; $workedModel = array_shift($path); $model = new $workedModel(); $this->_queryBuilder = $model->queryBuilder(); $name = \Engine\Mvc\Model::NAME; $this->_queryBuilder->columnsJoinOne($path, $name); $mainModel = $this->_grid->getContainer()->getDataSource()->getModel(); $relations = $mainModel->getRelationPath($workedModel); if (!$relations) { throw new \Engine\Exception("Relations to model '" . get_class($model) . "' by path '" . implode(", ", $path) . "' not valid"); } $relation = array_pop($relations); $field = $relation->getReferencedFields(); $this->_queryBuilder->where($field . " = :id:"); if ($this->_count) { $this->_queryBuilder->limit($this->_count); } $this->_queryBuilder->orderBy($this->_orderBy); } $rows = $this->_queryBuilder->getQuery()->execute(['id' => $id]); $values = []; foreach ($rows as $row) { $values[] = $row->{$name}; } return $values; }