Example #1
0
 public function registerChain($section, QueryChain $chain, $opt_key = null)
 {
     $alias = $chain->getAlias();
     if (isset($this->global_chains[$alias])) {
         $reg_chain = $this->global_chains[$alias];
     } else {
         $reg_chain = $chain;
         $def = $reg_chain->getDefinition();
         $this->global_chains[$alias] = $chain;
         $this->global_chains[$def] = $chain;
     }
     $storage_name = $section . '_chains';
     $this->{$storage_name}[$alias] = $reg_chain;
     if (!is_null($opt_key)) {
         $this->{$storage_name}[$opt_key] = $reg_chain;
     }
     return $reg_chain;
 }
Example #2
0
 public function registerChain($section, QueryChain $chain, $opt_key = null)
 {
     $alias = $chain->getAlias();
     if (isset($this->global_chains[$alias])) {
         $reg_chain = $this->global_chains[$alias];
     } else {
         $reg_chain = $chain;
         $def = $reg_chain->getDefinition();
         $this->global_chains[$alias] = $chain;
         $this->global_chains[$def] = $chain;
     }
     $storage_name = $section . '_chains';
     $this->{$storage_name}[$alias] = $reg_chain;
     if (!is_null($opt_key)) {
         $this->{$storage_name}[$opt_key] = $reg_chain;
     }
     // get default options from expressions
     if ($chain->getLastElement()->getValue() instanceof ExpressionField) {
         $options = $chain->getLastElement()->getValue()->getOptions();
         if (!empty($options)) {
             foreach ($options as $option => $value) {
                 if (!isset($this->options[$option])) {
                     $this->options[$option] = $value;
                 }
             }
         }
     }
     return $reg_chain;
 }