protected function outputField(InputInterface $input, OutputInterface $output, $field) { $phpName = $field->getStandardName(); $name = NameTransform::decamelize($phpName); $size = null; switch ($field->getDataType()) { case 'DateTime': case 'Date': $type = 'timestamp'; break; case 'Character': $type = 'varchar'; $size = $field->getMaximumLength(); break; case 'Numeric': case 'Int': $type = 'integer'; break; case 'Decimal': $type = 'double'; break; default: $output->writeln(sprintf('<error>Unknown type: %s</error>', $field->getDataType())); } if ($size) { $size = " size=\"{$size}\""; } $output->writeln(sprintf(' <column name="%s" phpName="%s" type="%s"%s />', $name, $phpName, $type, $size)); }
protected function outputResource(InputInterface $input, OutputInterface $output, $resource) { $output->writeln(sprintf("// Resource: %s", $resource->getResourceID())); $output->writeln(sprintf('$map = [', NameTransform::decamelize($resource->getResourceID()), $resource->getResourceID())); foreach ($resource->getClasses() as $class) { $output->writeln(''); $output->writeln(sprintf(' \'%s\' => [', $class->getClassName())); foreach ($this->rets->getTableMetadata($resource->getResourceID(), $class->getClassName()) as $field) { $output->writeln(sprintf(' \'%s\',', $field->getStandardName())); } $output->writeln(sprintf(' ],', $class->getClassName())); $output->writeln(''); } $output->writeln('];'); $output->writeln(sprintf("// End Resource %s", $resource->getResourceID())); }