public function fillTemplate($templateData) { $templateData = GeneratorUtils::fillTemplate($this->commandData->dynamicVars, $templateData); $fieldTypes = $this->commandData->getSwaggerTypes(); $fieldTypes = array_merge($fieldTypes, [['name' => "limit", 'type' => "integer", "description" => "Limit the number of results returned"], ['name' => "offset", 'type' => "integer", "description" => "Records from give Offset"], ['name' => "sort", 'type' => "string", "description" => "Sort records by given field"]]); $templateData = str_replace('$PARAMETERS$', implode(",\n", $this->generateSwagger($fieldTypes)), $templateData); return $templateData; }
private function fillTemplate($templateData) { if (!$this->commandData->useSoftDelete) { $templateData = str_replace('$SOFT_DELETE_IMPORT$', '', $templateData); $templateData = str_replace('$SOFT_DELETE$', '', $templateData); $templateData = str_replace('$SOFT_DELETE_DATES$', '', $templateData); } $templateData = GeneratorUtils::fillTemplate($this->commandData->dynamicVars, $templateData); $fillables = []; foreach ($this->commandData->inputFields as $field) { if (in_array($field['fieldName'], $this->commandData->excludedFields) or $field['fieldName'] == "id") { continue; } $fillables[] = '"' . $field['fieldName'] . '"'; } $templateData = str_replace('$FIELDS$', implode(",\n\t\t", $fillables), $templateData); $templateData = str_replace('$RULES$', implode(",\n\t\t", $this->generateRules()), $templateData); $castFields = $this->generateCasts(); $templateData = str_replace('$CAST$', implode(",\n\t\t", $castFields), $templateData); $fieldTypes = $this->commandData->getSwaggerTypes(); $templateData = str_replace('$SWAGGER_DOCS$', $this->generateSwagger($fieldTypes, $fillables), $templateData); return $templateData; }