Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

moved to using traits

  • Loading branch information...
commit 9c50811a966f2219f09195213cbef3448c23d0b2 1 parent 249ca14
@tthomas48 authored
Showing with 13 additions and 2 deletions.
  1. +13 −2 BuyPlayTix/DataBean/BuilderTask.php
View
15 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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.