Permalink
Browse files

moved to using traits

  • Loading branch information...
1 parent 249ca14 commit 9c50811a966f2219f09195213cbef3448c23d0b2 @tthomas48 committed Jan 10, 2013
Showing with 13 additions and 2 deletions.
  1. +13 −2 BuyPlayTix/DataBean/BuilderTask.php
@@ -123,8 +123,19 @@ private function processTable($class, $table) {
$fields[] = $row;
}
$output = '<?p' . "hp\n";
- $output .= "$class::\$field_defs = " . var_export($fields, true) . ";\n";
-
+ $output .= "namespace BuyPlayTix\DataBean\Builder;\n";
+ $output .= "trait " . strtolower($table) . "_trait { \n\n";
+ foreach($fields as $field) {
+ $output .= " public function get_" . strtolower($field["Field"]) . "() {";
+ $output .= " return \$this->" . $field["Field"] . ";\n";
+ $output .= " }\n\n";
+
+ $output .= " public function set_" . strtolower($field["Field"]) . "(\$v) {";
+ $output .= " return \$this->" . $field["Field"] . " = \$v;\n";
+ $output .= " }\n\n";
+ }
+ $output .= "}\n";
+
$path = $this->outputdir . strtolower($table) . ".php";
file_put_contents($path, $output);
}

0 comments on commit 9c50811

Please sign in to comment.