Example #1
0
 public function __construct(Mapper $mapper, array $namespaces, array $paths)
 {
     $this->mapper = $mapper;
     $this->namespaces = $namespaces;
     $this->paths = $paths;
     $this->tables = $this->mapper->generate();
 }
try {
    $newModel = new Model($outputDir, $tableToModel, $fields);
    $newModel->generate();
    // Debug
    //die( $newModel->getOutput() );
    // Write it
    echo "Attempting to write model to file: {$newModel->getTargetFile()}\n";
    $newModel->write();
    echo "SUCCESS! Model written to: {$newModel->getTargetFile()}\n\n";
} catch (Exception $e) {
    echo 'ERROR:' . $e->getMessage() . "\n";
}
// Make the Mapper
try {
    $newMapper = new Mapper($outputDir, $tableToModel, $fields);
    $newMapper->generate();
    // Debug
    //die( $newMapper->getOutput() );
    // Write it
    echo "Attempting to write mapper to file: {$newMapper->getTargetFile()}\n";
    $newMapper->write();
    echo "SUCCESS! Mapper written to: {$newMapper->getTargetFile()}\n\n";
} catch (Exception $e) {
    echo 'ERROR:' . $e->getMessage() . "\n";
}
// Make the test cases
try {
    $newTestCase = new TestCase($testDir, $tableToModel, $fields);
    $newTestCase->generate();
    // Debug
    //die( $newTestCase->getOutput() );