Пример #1
0
 /**
  * Provide a hook implementation
  *
  * @param   string  $name           Name of the hook for which to provide an implementation
  * @param   string  $implementation [optional] Fully qualified name of the class providing the hook implementation.
  *                                  Defaults to the module's ProvidedHook namespace plus the hook's name for the
  *                                  class name. Web 2's namespace separator is \\ (double backslash) at the moment
  * @param   string  $key            No-op arg for compatibility reasons. This argument is deprecated and will be
  *                                  removed in version 2.2.0
  *
  * @return  $this
  */
 protected function provideHook($name, $implementation = null, $key = null)
 {
     if ($implementation === null) {
         $implementation = $name;
     }
     if (strpos($implementation, '\\') === false) {
         $class = $this->getNamespace() . '\\ProvidedHook\\' . $this->slashesToNamespace($implementation);
     } else {
         $class = $implementation;
     }
     Hook::register($name, $implementation, $class);
     return $this;
 }
Пример #2
0
 /**
  * Set up this query and join the initial tables
  *
  * @see IdoQuery::initializeForPostgres     For postgresql specific setup
  */
 protected function init()
 {
     parent::init();
     $this->prefix = $this->ds->getTablePrefix();
     foreach (Hook::all('monitoring/idoQueryExtension') as $hook) {
         $extensions = $hook->extendColumnMap($this);
         if (!is_array($extensions)) {
             continue;
         }
         foreach ($extensions as $vTable => $cols) {
             if (!array_key_exists($vTable, $this->columnMap)) {
                 $this->hookedVirtualTables[$vTable] = $hook;
                 $this->columMap[$vTable] = array();
             }
             foreach ($cols as $k => $v) {
                 $this->columnMap[$vTable][$k] = $v;
             }
         }
     }
     $dbType = $this->ds->getDbType();
     if ($dbType === 'oracle') {
         $this->initializeForOracle();
     } elseif ($dbType === 'pgsql') {
         $this->initializeForPostgres();
     }
     $this->joinBaseTables();
     $this->select->columns($this->columns);
     $this->prepareAliasIndexes();
 }
Пример #3
0
 protected function getHookedColumns()
 {
     $columns = array();
     foreach (Hook::all('monitoring/dataviewExtension') as $hook) {
         foreach ($hook->getAdditionalQueryColumns($this->getQueryName()) as $col) {
             $columns[] = $col;
         }
     }
     return $columns;
 }