Changeset 198 for trunk/trax/vendor/trax/trax_generator.php
- Timestamp:
- 04/20/06 10:20:30 (6 years ago)
- Files:
-
- 1 modified
-
trunk/trax/vendor/trax/trax_generator.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/trax/vendor/trax/trax_generator.php
r195 r198 346 346 347 347 # Create the extra folders for View / Controller 348 if(!file_exists($this->view_path)) { 348 if(file_exists($this->view_path)) { 349 echo "exists $this->view_path\n"; 350 } else{ 349 351 $this->exec("$this->mkdir_cmd $this->view_path"); 350 } 351 352 if(!file_exists($this->controller_path)) { 352 echo "create $this->view_path\n"; 353 } 354 355 if(file_exists($this->controller_path)) { 356 echo "exists $this->controller_path\n"; 357 } else { 353 358 $this->exec("$this->mkdir_cmd $this->controller_path"); 354 } 355 356 if(!file_exists($this->helper_path)) { 359 echo "create $this->controller_path\n"; 360 } 361 362 if(file_exists($this->helper_path)) { 363 echo "exists $this->helper_path\n"; 364 } else { 357 365 $this->exec("$this->mkdir_cmd $this->helper_path"); 366 echo "create $this->helper_path\n"; 358 367 } 359 368 … … 414 423 echo "error creating model file: $model_file\n"; 415 424 } else { 416 echo "create d$model_file\n";425 echo "create $model_file\n"; 417 426 return true; 418 427 } … … 457 466 $human_model_name = Inflector::humanize($model_name); 458 467 459 $this->{$singluar_model_name} = new $model_class_name(); 468 try { 469 $this->{$singluar_model_name} = new $model_class_name(); 470 } catch (ActiveRecordError $e) { 471 echo "Can't create model.\n"; 472 echo $e->getMessage()."\n"; 473 echo "for database '" 474 . $GLOBALS['TRAX_DB_SETTINGS'][TRAX_MODE]['database'] 475 . "' on host '" 476 . $GLOBALS['TRAX_DB_SETTINGS'][TRAX_MODE]['hostspec'] 477 . "' as user '" 478 . $GLOBALS['TRAX_DB_SETTINGS'][TRAX_MODE]['username'] 479 . "'\nDid you configure file " 480 . TRAX_ROOT . $GLOBALS['TRAX_INCLUDES']['config'] 481 . "/database.ini correctly?\n"; 482 die(); 483 } 460 484 if(empty($controller_name)) { 461 485 $controller_name = Inflector::underscore($model_name); … … 499 523 echo "error creating controller class file: $controller_file\n"; 500 524 } else { 501 echo "create d$controller_file\n";525 echo "create $controller_file\n"; 502 526 } 503 527 } else { … … 515 539 echo "error creating view file: $view_file\n"; 516 540 } else { 517 echo "create d$view_file\n";541 echo "create $view_file\n"; 518 542 } 519 543 } else { … … 531 555 echo "error creating view file: $view_file\n"; 532 556 } else { 533 echo "create d$view_file\n";557 echo "create $view_file\n"; 534 558 } 535 559 } else { … … 547 571 echo "error creating view file: $view_file\n"; 548 572 } else { 549 echo "create d$view_file\n";573 echo "create $view_file\n"; 550 574 } 551 575 } else { … … 563 587 echo "error creating view file: $view_file\n"; 564 588 } else { 565 echo "create d$view_file\n";589 echo "create $view_file\n"; 566 590 } 567 591 } else { … … 572 596 $view_file = "$this->view_path/_form.".$this->view_file_extention; 573 597 ob_start(); 574 include("$this->scaffold_template_path/form_scaffolding.phtml");598 require "$this->scaffold_template_path/form_scaffolding.phtml"; 575 599 $_form_contents = $this->fix_php_brackets(ob_get_contents()); 576 600 ob_end_clean(); … … 579 603 echo "error creating view file: $view_file\n"; 580 604 } else { 581 echo "create d$view_file\n";605 echo "create $view_file\n"; 582 606 } 583 607 } else { … … 598 622 echo "error creating layout file: $layout_file\n"; 599 623 } else { 600 echo "create d$layout_file\n";624 echo "create $layout_file\n"; 601 625 } 602 626 } else { … … 654 678 . $controller_file . "\n"; 655 679 } else { 656 echo "create d$controller_file\n";680 echo "create $controller_file\n"; 657 681 } 658 682 … … 688 712 echo "error creating helper file: $helper_file\n"; 689 713 } else { 690 echo "create d$helper_file\n";714 echo "create $helper_file\n"; 691 715 } 692 716 … … 732 756 echo "error creating view file: $view_file\n"; 733 757 } else { 734 echo "create d$view_file\n";758 echo "create $view_file\n"; 735 759 } 736 760 } else {
