Example #1
0
 /**
  * Метод проверяет, относится ли фолдинг к SDK
  */
 public function isSdkFolding(FoldedResources $folding)
 {
     $funique = $folding->getUnique();
     if (array_key_exists($funique, $this->UNIQUE_2_PROVIDER)) {
         $provider = $this->UNIQUE_2_PROVIDER[$funique];
         return $provider::isSdk();
     }
     raise_error("Folding '{$folding}' is not registered in any foldings provider");
 }
Example #2
0
 /** @return FoldedEntity */
 public static function inst(FoldedResources $folding, $ident, $assertExists = true)
 {
     $unique = $folding->getUnique($ident);
     if (!array_key_exists($unique, self::$items)) {
         if ($assertExists) {
             $folding->assertExistsEntity($ident);
         }
         self::$items[$unique] = new FoldedEntity($folding, $ident);
     }
     return self::$items[$unique];
 }
Example #3
0
 /**
  * Метод возвращает видимые пользователю объекты из базы
  */
 public function getVisibleObjects(FoldedResources $folded, $objName, array $visibleIdents)
 {
     $folded->assertWorkWithTable();
     $cacheKey = $folded->getUnique("visible-{$objName}");
     if (!$this->CACHE->has($cacheKey)) {
         $view = $folded->getTableView();
         $colIdent = $folded->getTableColumnIdent();
         $colStype = $folded->getTableColumnStype();
         $where = array();
         if ($colStype) {
             $where[$colStype] = $folded->getFoldingSubType();
         }
         $this->CACHE->set($cacheKey, $this->getArray(Query::select('*', $view, $where), null, ObjectQueryFetcher::inst($objName, $colIdent)->setIncludeKeys($visibleIdents)));
     }
     return $this->CACHE->get($cacheKey);
 }
 public static function onEntityAction($action, FoldedResources $folding, $ident = null, $msg = null)
 {
     if (self::inst()->LOGGER->isEnabled()) {
         self::inst()->ACTIONS[$action][] = array($folding->getUnique($ident), $msg);
     }
 }
 /**
  * Метод регистрации экземпляров фолдингов
  * 
  * @param FoldedResources $inst - экземпляр
  */
 protected final function register(FoldedResources $inst)
 {
     $unique = $inst->getUnique();
     if (array_key_exists($unique, $this->FOLDINGS)) {
         PsUtil::raise('Folding \'{}\' is already registered. Cannot register \'{}\' with same unique.', $this->FOLDINGS[$unique], $inst);
     } else {
         $this->FOLDINGS[$unique] = $inst;
         if ($this->LOGGER->isEnabled()) {
             $this->LOGGER->info('+{}. {}, count: {}.', pad_left(count($this->FOLDINGS), 3, ' '), $inst, FoldedStorage::getEntitiesCount($unique));
         }
     }
 }