Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Patch for bubbling RTCQueue updates. This patch builds the bubble functions into every model on creation.
diff --git a/build/generation/models.php b/build/generation/models.php
index 4b41bea..aa500a5 100644
--- a/build/generation/models.php
+++ b/build/generation/models.php
@@ -221,11 +221,27 @@ EOF;
public function getBy{$name}($args) {
return self::getByAttributes(array($selector));
- }
-
+ }
+
+ public function bubbleUpdateResult(\$update_result) {
+ \$update_result->module = get_class();
+ \Library\RTCQueue::Send("/model/ordersalesquote/\{\$this->id\}", \$update_result);
+ $this->getOrderSales()->bubbleUpdateResult(\$update_result);
EOF;
+ foreach ($models[$table]['multi'] as $col=>$key) {
+ //if ($key[2] != $models[$key[1]]['key'][0] || count($models[$key[1]]['key']) != 1) {
+ // continue;
+ //}
+ $className = getClassName($key[1]);
+ $selfName = getClassName($table);
+ $column = getClassName($key[0]);
+ $file .= "
+ \$this->get{$column}()->bubbleUpdateResult(\$update_result)\r\n";
}
-
+
+ $file .= <<<EOF
+ }
+EOF;
$file .= <<<EOF
}
@@ -263,6 +279,9 @@ namespace Model;
*
*/
class $c extends \\System\\Model\\{$c} {
+
+
+ $file .= <<<EOF
}
EOF;
echo "CREATING $f\r\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment