@@ -266,7 +266,7 @@ |
||
| 266 | 266 | |
| 267 | 267 | if ($Query->is_success()) { |
| 268 | 268 | foreach ($Query->ret_obj(get_called_class()) as $rec) { |
| 269 | - $ret[$rec->get($pk_name)] = $rec; |
|
| 269 | + $ret[$rec->get($pk_name)] = $rec; |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public function __toString() |
| 17 | 17 | { |
| 18 | - return static::class_short_name() . ' #' . $this->get_id(); |
|
| 18 | + return static::class_short_name().' #'.$this->get_id(); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function traceable(): bool |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $extraction_table = $extraction_class::table(); |
| 41 | 41 | foreach ($extraction_table->columns() as $column_name => $column) { |
| 42 | - $probe_name = $extraction_class::table_alias() . '_' . $column_name; |
|
| 42 | + $probe_name = $extraction_class::table_alias().'_'.$column_name; |
|
| 43 | 43 | |
| 44 | 44 | if (!is_null($probe_res = $this->get($probe_name))) { |
| 45 | 45 | $extract_model->set($column_name, $probe_res); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $ret = []; |
| 254 | 254 | $pk_name = implode('_', array_keys($Query->table()->primary_keys())); |
| 255 | 255 | |
| 256 | - if (count($pks = $Query->table()->primary_keys()) > 1) { |
|
| 256 | + if (count($pks = $Query->table()->primary_keys())>1) { |
|
| 257 | 257 | $concat_pk = sprintf('CONCAT(%s) as %s', implode(',', $pks), $pk_name); |
| 258 | 258 | $Query->select_also([$concat_pk]); |
| 259 | 259 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | public static function table_alias(): string |
| 295 | 295 | { |
| 296 | - return defined(get_called_class() . '::TABLE_ALIAS') ? static::TABLE_ALIAS : static::model_type(); |
|
| 296 | + return defined(get_called_class().'::TABLE_ALIAS') ? static::TABLE_ALIAS : static::model_type(); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | public static function class_short_name() |
@@ -96,9 +96,9 @@ |
||
| 96 | 96 | if (!empty($date_stop)) { |
| 97 | 97 | $this->statement()->aw_lte($this->model()->event_field(), $date_stop, $this->statement()->table_label(), ':filter_date_stop'); |
| 98 | 98 | } |
| 99 | - // |
|
| 100 | - // if(empty($options['order_by'])) |
|
| 101 | - // $this->statement()->order_by([$this->model()->event_field(), 'DESC']); |
|
| 99 | + // |
|
| 100 | + // if(empty($options['order_by'])) |
|
| 101 | + // $this->statement()->order_by([$this->model()->event_field(), 'DESC']); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public function filter_with_ids($ids) |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | public function import($assoc_data) |
| 42 | 42 | { |
| 43 | 43 | if (!is_array($assoc_data)) { |
| 44 | - throw new \Exception(__FUNCTION__ . '(assoc_data) parm is not an array'); |
|
| 44 | + throw new \Exception(__FUNCTION__.'(assoc_data) parm is not an array'); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // shove it all up in model, god will sort them out |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | if ($table_name === false) { |
| 70 | 70 | $calling_class = $reflect->getShortName(); |
| 71 | - if (defined($const_name = 'TABLE_' . strtoupper($calling_class))) { |
|
| 71 | + if (defined($const_name = 'TABLE_'.strtoupper($calling_class))) { |
|
| 72 | 72 | $table_name = constant($const_name); |
| 73 | 73 | } else { |
| 74 | 74 | $table_name = strtolower($calling_class); |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | public static function otm($k = null) |
| 68 | 68 | { |
| 69 | 69 | $type = static::model_type(); |
| 70 | - $d = ['t' => $type . 's_models', 'k' => $type . '_id', 'a' => $type . 's_otm']; |
|
| 70 | + $d = ['t' => $type.'s_models', 'k' => $type.'_id', 'a' => $type.'s_otm']; |
|
| 71 | 71 | return is_null($k) ? $d : $d[$k]; |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -6,23 +6,23 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | trait Traceable |
| 8 | 8 | { |
| 9 | - abstract public function get_tracer() : TracerInterface; |
|
| 10 | - abstract public function get_id(); |
|
| 11 | - abstract public static function table_name(); |
|
| 9 | + abstract public function get_tracer() : TracerInterface; |
|
| 10 | + abstract public function get_id(); |
|
| 11 | + abstract public static function table_name(); |
|
| 12 | 12 | |
| 13 | 13 | |
| 14 | - public function trace() |
|
| 15 | - { |
|
| 14 | + public function trace() |
|
| 15 | + { |
|
| 16 | 16 | ; |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - public function traceable(): bool |
|
| 20 | - { |
|
| 19 | + public function traceable(): bool |
|
| 20 | + { |
|
| 21 | 21 | return true; // TightORM are traced by default |
| 22 | - } |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - public function traces() : array |
|
| 25 | - { |
|
| 24 | + public function traces() : array |
|
| 25 | + { |
|
| 26 | 26 | $q = $this->get_tracer()->tracing_table()->select(); |
| 27 | 27 | $q->aw_fields_eq(['query_table' => get_class($this)::table_name(), 'query_id' => $this->get_id()]); |
| 28 | 28 | $q->order_by(['query_on', 'DESC']); |
@@ -30,21 +30,21 @@ discard block |
||
| 30 | 30 | $res = $q->ret_ass(); |
| 31 | 31 | |
| 32 | 32 | return $res; |
| 33 | - } |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - // don't really know the purpose of this anymore.. came from Tracer |
|
| 36 | - public function traces_by_model(ModelInterface $m) |
|
| 37 | - { |
|
| 38 | - return $this->get_tracer()->traces(['id' => $m->get_id(), 'table' => get_class($m)::table_name()]); |
|
| 39 | - } |
|
| 35 | + // don't really know the purpose of this anymore.. came from Tracer |
|
| 36 | + public function traces_by_model(ModelInterface $m) |
|
| 37 | + { |
|
| 38 | + return $this->get_tracer()->traces(['id' => $m->get_id(), 'table' => get_class($m)::table_name()]); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - public function after_save() |
|
| 42 | - { |
|
| 41 | + public function after_save() |
|
| 42 | + { |
|
| 43 | 43 | ; |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - public function after_destroy() |
|
| 47 | - { |
|
| 46 | + public function after_destroy() |
|
| 47 | + { |
|
| 48 | 48 | ; |
| 49 | - } |
|
| 49 | + } |
|
| 50 | 50 | } |