/** * Action to get the relation field options of the provided model * @param \ride\web\cms\orm\FieldService $fieldService * @param string $model Name of the model * @return null */ public function relationFieldsAction(FieldService $fieldService, $model) { if ($model) { $fields = $fieldService->getFields($model, true, true, 1); } else { $fields = array(); } $this->setJsonView(array('fields' => $fields)); }
/** * Gets the options for the model field * @return array Array with the name of the model as key and as value */ protected function getModelOptions() { $models = $this->fieldService->getOrm()->getModels(true); ksort($models); $options = array(); foreach ($models as $modelName => $model) { $options[$modelName] = $modelName; } return $options; }