3 class ORMStructureManifestGenerator
extends class_generator
{
4 private $full_structure = array();
6 public function __construct( $full_structure ) {
7 $this->full_structure
= $full_structure;
8 $this->classname
= "orm_structure";
12 public function generate($skip_generated_note = false) {
13 parent
::generate($skip_generated_note);
15 foreach( $this->full_structure
as $table => $struct ) {
17 foreach( $struct['structure'] as $field => $type ) {
18 if( is_array( $type ) ) {
19 $tblresult[$field] = array( 'object', $this->lookup_class($type[0]) );
21 $tblresult[$field] = array( $type );
24 $result[$table] = $tblresult;
26 $this->write('$manifest[%s] = %s;', $table, $tblresult);
30 private function lookup_class( $class ) {
31 foreach( $this->full_structure
as $table => $struct ) {
32 if( $struct['class'] == $class ) {