3 require_once( __DIR__
.'/../js_class_generator.php' );
4 require_once( __DIR__
.'/../class_generator.php' );
6 require_once( 'ORMObjectGenerator.php' );
7 require_once( 'ORMObjectPoolGenerator.php' );
8 require_once( 'ORMRootGenerator.php' );
9 require_once( 'ORMRootPoolGenerator.php' );
10 require_once( 'ORMRootSetGenerator.php' );
12 require_once( 'ORMWrapperGenerator.php' );
14 require_once( 'ORMLSSetGenerator.php' );
15 require_once( 'ORMSQLSetGenerator.php' );
17 require_once( 'ORMTableManifestGenerator.php' );
18 require_once( 'ORMStructureManifestGenerator.php' );
26 public function generate_base() {
27 /* Generate base root class */
28 $generator = new ORMRootGenerator();
29 $generator->set_class_dir('base');
30 $generator->generate();
31 $path = $generator->get_include_path();
33 /* Generate root class wrapper */
34 $generator = new ORMWrapperGenerator( 'Object', false, $path );
35 if( !$generator->exists() )
36 $generator->generate();
38 /* Generate base pool class */
39 $generator = new ORMRootPoolGenerator();
40 $generator->set_class_dir('base');
41 $generator->generate();
42 $path = $generator->get_include_path();
44 /* Generate pool class wrapper if not exists */
45 $generator = new ORMWrapperGenerator( 'ObjectPool', false, $path );
46 if( !$generator->exists() )
47 $generator->generate();
49 /* Generate base set class */
50 $generator = new ORMRootSetGenerator();
51 $generator->set_class_dir('base');
52 $generator->generate();
53 $path = $generator->get_include_path();
55 /* Generate set class wrapper if not exists */
56 $generator = new ORMWrapperGenerator( 'ObjectSet', false, $path );
57 if( !$generator->exists() )
58 $generator->generate();
66 public function generate_table( $name, $full_structure ) {
67 $structure = $full_structure[$name];
69 /* Generate base class */
70 $generator = new ORMObjectGenerator( $name, $full_structure );
71 $generator->set_class_dir('base');
72 $generator->generate();
73 $path = $generator->get_include_path();
75 /* Generate wrapper if not exists */
76 $generator = new ORMWrapperGenerator( $structure['class'], false, $path );
77 if( !$generator->exists() )
78 $generator->generate();
80 /* Generate base pool class */
81 $generator = new ORMObjectPoolGenerator( $name, $full_structure );
82 $generator->set_class_dir('base');
83 $generator->generate();
84 $path = $generator->get_include_path();
86 /* Generate pool wrapper if not exists */
87 $generator = new ORMWrapperGenerator( $structure['class']."Pool", false, $path );
88 if( !$generator->exists() )
89 $generator->generate();
91 /* Generate base set class */
92 /* We need the source generator available when generating the object */
93 $source_classname = "ORM".$structure['source'] ."SetGenerator";
94 require_once( "$source_classname.php" );
95 $generator = new $source_classname( $name, $full_structure );
96 $generator->set_class_dir('base');
97 $generator->generate();
98 $path = $generator->get_include_path();
100 /* Generate set wrapper if not exists */
101 $generator = new ORMWrapperGenerator( $structure['class']."Set", false, $path );
102 if( !$generator->exists() )
103 $generator->generate();
111 public function generate_manifest( $full_structure ) {
112 /* Generate Table classes description */
113 $generator = new ORMTableManifestGenerator( $full_structure );
114 $generator->generate();
116 /* Generate Table structure description */
117 $generator = new ORMStructureManifestGenerator( $full_structure );
118 $generator->generate();