Construct the controller fields

@param $schema
@param $meta
@return string
420438
private function createSchemaForControllerMethod($schema, $meta)
    {


        if (!$schema) return '';

        $fields = array_map(function ($field) use ($meta) {
            return $this->AddColumn($field, 'controller', $meta);
        }, $schema);


        return implode("\n" . str_repeat(' ', 8), $fields);
    }
773366
public function generateEntityClass(EntityMetadata $meta)
    {
        $placeholders = array(
            '<namespace>',
            '<classAnnotations>',
            '<className>',
            '<implements>',
            '<traits>'
        );

        $replacements = array(
            $this->namespace,
            $this->generateClassAnnotations($meta->getTraits()),
            $meta->getClassName(),
            $this->generateImplements($meta->getInterfaces()),
            $this->generateTraitStatements($meta->getTraits())
        );

        $code = str_replace($placeholders, $replacements, self::$template);
        return str_replace('<spaces>', self::$spaces, $code);
    }
104735
protected function writeSchemaHelp($schema) {
        // Write the command description.
        $meta = Cli::val(Cli::META, $schema, []);
        $description = Cli::val('description', $meta);

        if ($description) {
            echo implode("\n", Cli::breakLines($description, 80, false)).PHP_EOL.PHP_EOL;
        }

        unset($schema[Cli::META]);

        // Add the help.
        $schema['help'] = [
            'description' => 'Display this help.',
            'type' => 'boolean',
            'short' => '?'
        ];

        echo Cli::bold('OPTIONS').PHP_EOL;

        ksort($schema);

        $table = new Table();
        $table->setFormatOutput($this->formatOutput);

        foreach ($schema as $key => $definition) {
            $table->row();

            // Write the keys.
            $keys = "--{$key}";
            if ($shortKey = Cli::val('short', $definition, false)) {
                $keys .= ", -$shortKey";
            }
            if (Cli::val('required', $definition)) {
                $table->bold($keys);
            } else {
                $table->cell($keys);
            }

            // Write the description.
            $table->cell(Cli::val('description', $definition, ''));
        }

        $table->write();
        echo PHP_EOL;

        $args = Cli::val(Cli::ARGS, $meta, []);
        if (!empty($args)) {
            echo Cli::bold('ARGUMENTS').PHP_EOL;

            $table = new Table();
            $table->setFormatOutput($this->formatOutput);

            foreach ($args as $argName => $arg) {
                $table->row();

                if (Cli::val('required', $arg)) {
                    $table->bold($argName);
                } else {
                    $table->cell($argName);
                }

                $table->cell(Cli::val('description', $arg, ''));
            }
            $table->write();
            echo PHP_EOL;
        }
    }
92175
function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){
		parent::nusoap_base();
		$this->debug('nusoap_xmlschema class instantiated, inside constructor');
		// files
		$this->schema = $schema;
		$this->xml = $xml;

		// namespaces
		$this->enclosingNamespaces = $namespaces;
		$this->namespaces = array_merge($this->namespaces, $namespaces);

		// parse schema file
		if($schema != ''){
			$this->debug('initial schema file: '.$schema);
			$this->parseFile($schema, 'schema');
		}

		// parse xml file
		if($xml != ''){
			$this->debug('initial xml file: '.$xml);
			$this->parseFile($xml, 'xml');
		}

	}
617910
function generateSchemaFile( $schema, $params = array() )
    {
        $sql = '';

        $i = 0;
        foreach ( $schema as $table => $tableDef )
        {
            // Skip the info structure, this is not a table
            if ( $table == '_info' )
                continue;

            if ( $i > 0 )
                $sql .= "\n\n";
            $sql .= $this->generateTableSchema( $table, $tableDef, $params );
            ++$i;
        }

        return $sql;
    }
562646
protected function execSchema(Schema $schema)
    {
        $query = $schema->build($this->database);

        return $this->database->exec(trim($query));
    }
1266009
public function getTemplateData($schema, $data = [])
    {
        $importTraits = $traits = [];
        if (isset($schema['deleted_at']) && $schema['deleted_at']['type'] === 'date') {
            $importTraits[] = $variables['SOFT_DELETE_IMPORT'];
            $traits[] = $variables['SOFT_DELETE_TRAIT'];
        }

        if ($this->command->type === 'model' && $this->command->option('auth')) {
            $importTraits = array_merge($importTraits, $variables['AUTH_IMPORT']);
            $traits = array_merge($traits, $variables['AUTH_TRAIT']);
        } else {
            $data['AUTH_IMPLEMENTS'] = '';
        }

        $data['IMPORT_TRAIT'] = !empty($importTraits) ? implode(PHP_EOL, $importTraits)."\n" : '';
        $data['USE_TRAIT'] = !empty($traits) ? "use ".implode(", ", $traits).";\n" : '';

        // generate fillable
        $fillableStr = [];
        foreach ($this->fillableColumns as $column) {
            $fillableStr[] = "'".$column['field']."'";
        }
        $data['FIELDS'] = implode(",\n\t\t", $fillableStr);

        $validations = $this->getValidationRules($data['TABLE_NAME']);
        $data['RULES'] = implode(",\n\t\t", $validations);

        $data['CAST'] = implode(",\n\t\t", $this->getCasts());

        $functions = $this->relationshipGenerator->getFunctionsFromTable($data['TABLE_NAME']);
        $relationships = implode("\n", $functions);
        $data['RELATIONSHIPS'] = $relationships;

        return $data;
    }
1173907
public function getColumns($table, $schema = null)
    {
        //Argument 1 must be a string
        Argument::i()->test(1, 'string')->test(2, 'string', 'null');
        
        $select = array(
            'columns.table_schema',
            'columns.column_name',
            'columns.ordinal_position',
            'columns.column_default',
            'columns.is_nullable',
            'columns.data_type',
            'columns.character_maximum_length',
            'columns.character_octet_length',
            'pg_class2.relname AS index_type');
        
        $where = array(
            "pg_attribute.attrelid = pg_class1.oid AND pg_class1.relname='".$table."'",
            'columns.column_name = pg_attribute.attname AND columns.table_name=pg_class1.relname',
            'pg_class1.oid = pg_index.indrelid AND pg_attribute.attnum = ANY(pg_index.indkey)',
            'pg_class2.oid = pg_index.indexrelid');
        
        if ($schema) {
            $where[1] .= ' AND columns.table_schema="'.$schema.'"';
        }
        
        $query = Select::i()
            ->select($select)
            ->from('pg_attribute')
            ->innerJoin('pg_class AS pg_class1', $where[0], false)
            ->innerJoin('information_schema.COLUMNS	AS columns', $where[1], false)
            ->leftJoin('pg_index', $where[2], false)
            ->leftJoin('pg_class AS pg_class2', $where[3], false)
            ->getQuery();
        
        $results = $this->query($query);
        
        $columns = array();
        foreach ($results as $column) {
            $key = null;
            if (strpos($column['index_type'], '_pkey') !== false) {
                $key = 'PRI';
            } else if (strpos($column['index_type'], '_key') !== false) {
                $key = 'UNI';
            }
            
            $columns[] = array(
                'Field'     => $column['column_name'],
                'Type'      => $column['data_type'],
                'Default'   => $column['column_default'],
                'Null'      => $column['is_nullable'],
                'Key'       => $key);
        }
        
        return $columns;
    }
1238724
function schema( $params = array() )
    {
        if ( $this->IsLintChecked )
        {
            return $this->CorrectSchema;
        }

        $params = array_merge( array( 'meta_data' => false,
                                      'format' => 'generic' ),
                               $params );

        $this->CorrectSchema = $this->OtherSchema->schema( $params );
        $this->lintCheckSchema( $this->CorrectSchema );
        $this->IsLintChecked = true;
        return $this->CorrectSchema;
    }
260058
protected function addVirtualFieldsToSchema(array $schema, string $module): array
    {
        if (isset($schema['definitions']['virtualFieldName'])) {
            $virtualFields = Utility::getVirtualModuleFields($module, false);
            if (!empty($virtualFields)) {
                $schema['definitions']['virtualFieldName']['enum'] = array_keys($virtualFields);
            }
        }

        return $schema;
    }
146348
protected function registerMetaFields()
    {
        $this->container
            ->share(GraphQL::SCHEMA_META_FIELD_DEFINITION, function ($__Schema) {
                return newField([
                    'name'        => '__schema',
                    'description' => 'Access the current type schema of this server.',
                    'type'        => newNonNull($__Schema),
                    'resolve'     => function ($source, $args, $context, ResolveInfo $info): Schema {
                        return $info->getSchema();
                    },
                ]);
            })
            ->addArgument(GraphQL::SCHEMA_INTROSPECTION);

        $this->container
            ->share(GraphQL::TYPE_META_FIELD_DEFINITION, function ($__Type) {
                return newField([
                    'name'        => '__type',
                    'description' => 'Request the type information of a single type.',
                    'type'        => $__Type,
                    'args'        => ['name' => ['type' => newNonNull(stringType())]],
                    'resolve'     => function ($source, $args, $context, ResolveInfo $info): ?TypeInterface {
                        ['name' => $name] = $args;
                        return $info->getSchema()->getType($name);
                    },
                ]);
            })
            ->addArgument(GraphQL::TYPE_INTROSPECTION);

        $this->container
            ->share(GraphQL::TYPE_NAME_META_FIELD_DEFINITION, function () {
                return newField([
                    'name'        => '__typename',
                    'description' => 'The name of the current Object type at runtime.',
                    'type'        => newNonNull(stringType()),
                    'resolve'     => function ($source, $args, $context, ResolveInfo $info): string {
                        return $info->getParentType()->getName();
                    },
                ]);
            });
    }
333711
private function describeTable($name, $schema)
    {
        $data = $this->connector->getQueryAsSingleRow(
                'SELECT t.table_schema AS table_schema, t.table_name AS table_name, t.engine AS engine,
                        t.auto_increment AS auto_increment, t.table_collation AS table_collation,
                        t.table_comment AS table_comment, cs.character_set_name AS table_charset,
                        t.create_options AS create_options
                   FROM information_schema.tables t, information_schema.character_sets cs
                  WHERE t.table_schema=\'%schema$s\'
                    AND t.table_name = \'%table$s\'
                    AND t.table_collation = cs.default_collate_name',
                array(
                    'schema' => $schema,
                    'table' => $name
                )
        );

        if (is_array($data)) {
            $fields = $this->describeTableFields($name, $schema);
            $table['schema'] = $data['table_schema'];
            $table['name'] = $data['table_name'];
            $table['engine'] = $data['engine'];
            $table['type'] = CMySQLConnector::TYPE_TABLE;
            $table['autoincrement'] = $this->validateAutoIncrement($data['auto_increment'], $fields);
            $table['charset'] = $data['table_charset'];
            $table['collation'] = $data['table_collation'];
            $table['create_options'] = $data['create_options'];
            $table['comment'] = $data['table_comment'];
            $table['fields'] = $fields;
            $table['constraints'] = $this->describeTableConstraints($name, $table['fields'], $schema);
            $descriptor = new CMySQLDescriptor($this->connector, $table);
        } else {
            $descriptor = null;
        }

        return $descriptor;
    }
1015491
public static function make($schema)
    {
        return new self(
            $schema,
            StringValidator::make($schema->getMeta()),
            FloatValidator::make($schema->getMeta()),
            IntValidator::make($schema->getMeta()),
            JsonValidator::make($schema->getMeta())
        );
    }
913162
protected function _initializeSchema(TableSchema $schema)
    {
        $type = Configure::read('EmailQueue.serialization_type') ?: 'email_queue.serialize';
        $schema->setColumnType('template_vars', $type);
        $schema->setColumnType('headers', $type);
        $schema->setColumnType('attachments', $type);

        return $schema;
    }
1149762
public function tableInfo($tableName, $schema = null)
    {
        return $this->_associateTableMeta($this->fetchAll('SELECT `column_name` as `name`, `data_type` AS `dataType`, `character_maximum_length` AS `maxLength`, `is_nullable` AS `null`, `column_default` AS `default`, `extra` AS `extra`, `column_key` AS `column_key` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `table_name` = :name AND `table_schema` = :schema ORDER BY `ordinal_position`', [
                    ':name' => $tableName,
                    ':schema' => $this->_config->name
        ]));
    }
1094385
public function getFieldDefinition(Schema $schema, ObjectType $parentType, string $fieldName): ?Field
    {
        if ($fieldName === '__schema' && $schema->getQueryType() === $parentType) {
            return SchemaMetaFieldDefinition();
        }

        if ($fieldName === '__type' && $schema->getQueryType() === $parentType) {
            return TypeMetaFieldDefinition();
        }

        if ($fieldName === '__typename') {
            return TypeNameMetaFieldDefinition();
        }

        $fields = $parentType->getFields();

        return $fields[$fieldName] ?? null;
    }
1084985
public function get_field_schema() {
		$fields = $this->get_registered_fields();

		$schema = array(
			'description' => __( 'Meta fields.' ),
			'type'        => 'object',
			'context'     => array( 'view', 'edit' ),
			'properties'  => array(),
		);

		foreach ( $fields as $key => $args ) {
			$schema['properties'][ $key ] = $args['schema'];
		}

		return $schema;
	}