示例#1
0
 public function getRegisteredChain($key, $force_create = false)
 {
     if (isset($this->global_chains[$key])) {
         return $this->global_chains[$key];
     }
     if ($force_create) {
         $chain = QueryChain::getChainByDefinition($this->init_entity, $key);
         $this->registerChain('global', $chain);
         return $chain;
     }
     return false;
 }
示例#2
0
 public function getBuildFromChains()
 {
     if (is_null($this->buildFromChains)) {
         $this->buildFromChains = array();
         foreach ($this->buildFrom as $elem) {
             $this->buildFromChains[] = QueryChain::getChainByDefinition($this->entity, $elem);
         }
     }
     return $this->buildFromChains;
 }
示例#3
0
 public static function getAliasByChain(QueryChain $chain)
 {
     $alias = array();
     $elements = $chain->getAllElements();
     // cut non-last expressions
     foreach ($elements as $k => $element) {
         if ($element->getValue() instanceof ExpressionField && $element !== end($elements)) {
             //unset($elements[$k]);
         }
     }
     // add prefix of init entity
     if (count($elements) > 2) {
         $alias[] = $chain->getFirstElement()->getAliasFragment();
     }
     // add other members of chain
     $elements = array_slice($elements, 1);
     foreach ($elements as $element) {
         $fragment = $element->getAliasFragment();
         if (strlen($fragment)) {
             $alias[] = $fragment;
         }
     }
     return join('_', $alias);
 }
 /**
  * @return QueryChain
  **/
 public static function exceptAllBlock()
 {
     $args = func_get_args();
     return QueryChain::block($args, self::EXCEPT_ALL);
 }