~coughphp/coughphp/2.0

« back to all changes in this revision

Viewing changes to cough_generator/CoughGeneratorConfig.class.php

  • Committer: Anthony Bush
  • Date: 2008-08-29 04:23:40 UTC
  • mfrom: (263.1.1 coughphp-trunk)
  • Revision ID: anthony@anthonybush.com-20080829042340-bgqx3n0robfnxdoz
Accept changes from trunk (1.3.1 release).

Show diffs side-by-side

added added

removed removed

Lines of Context:
317
317
                }
318
318
        }
319
319
        
 
320
        public function shouldGenerateForTable(SchemaTable $table) {
 
321
                if (!$table->hasPrimaryKey()) {
 
322
                        return false;
 
323
                }
 
324
                return true;
 
325
        }
 
326
        
320
327
        public function shouldGenerateHasOneMethods(SchemaRelationship $hasOne) {
 
328
                // Don't generate links to tables we won't generate classes for.
 
329
                if (!$this->shouldGenerateForTable($hasOne->getRefTable())) {
 
330
                        return false;
 
331
                }
321
332
                $table = $hasOne->getLocalTable();
322
333
                $dbName = $table->getDatabase()->getDatabaseName();
323
334
                $tableName = $table->getTableName();
335
346
        }
336
347
        
337
348
        public function shouldGenerateHasManyMethods(SchemaRelationship $hasMany) {
 
349
                // Don't generate links to tables we won't generate classes for.
 
350
                if (!$this->shouldGenerateForTable($hasMany->getRefTable())) {
 
351
                        return false;
 
352
                }
338
353
                $table = $hasMany->getLocalTable();
339
354
                $dbName = $table->getDatabase()->getDatabaseName();
340
355
                $tableName = $table->getTableName();