public static function cond_instance($column, $column_alias, $table, $table_alias) { $self = new self(); $self->column($column); $self->column_alias($column_alias); $self->table($table); $self->table_alias($table_alias); $self->base(false); return $self; }
public function provideSchemas() { $schemas = array(); foreach (['co2', 'o3', 'so'] as $t) { $schema = new self(); $schema->table($t); $schemas[] = $schema; } return $schemas; }
/** * Logs new content into the logger */ public static function log($content, $type = null, $level = null) { $logger = new self(); if (!empty($type)) { $logger->table($type); } // set the fields to store $level = in_array($level, self::$log_levels) ? $level : self::INFO; $fields = ['log_level' => $level, 'log_timestamp' => time()]; // add custom content, objects will be store as fields $content = is_object($content) ? get_object_vars($content) : ['content' => $content]; $fields = array_merge($fields, $content); $logger->async(true)->put($fields); }
/** * Finds webhook configs by even * * @param string $eventName Event type * @param int $farmId The identifier of the farm * @param int $accountId The identifier of the client's account * @param int $envId The identifier of the environment * @return ArrayCollection Gets collection of the WebhookConfig objects */ public static function findByEvent($eventName, $farmId, $accountId, $envId) { $ret = new ArrayCollection(); $cfg = new self(); $res = $cfg->db()->Execute("\n SELECT " . $cfg->fields('c') . "\n FROM " . $cfg->table() . " c\n JOIN `webhook_config_events` ce ON ce.webhook_id = c.webhook_id\n WHERE ce.event_type = ?\n AND (\n (c.account_id = ? AND c.env_id = ? AND `level` = 4) OR\n (c.account_id = ? AND c.env_id IS NULL AND `level` = 2) OR\n (c.account_id IS NULL AND c.env_id IS NULL AND `level` = 1)\n )\n AND EXISTS (\n SELECT 1 FROM `webhook_config_farms` cf\n WHERE cf.webhook_id = c.webhook_id\n AND (cf.farm_id = 0 OR cf.farm_id = ?)\n )\n ", array($eventName, $accountId, $envId, $accountId, $farmId)); while ($item = $res->FetchRow()) { $cfg = new self(); $cfg->load($item); $ret->append($cfg); unset($cfg); } return $ret; }