示例#1
0
 /**
  * @return array
  */
 private function engines()
 {
     return array('iblockElement' => IblockElement::className(), 'common' => Common::className(), 'list' => Enum::className(), 'file' => File::className(), 'user' => User::className(), 'bitrixOrmElement' => BitrixOrmElement::className());
 }
 /**
  * Convert attribute chain (by relations)
  * to api fields chain (for query)
  *
  * @param string $attrsChain
  * @return string
  * @throws Exception
  */
 protected function fieldByAttrChainForOrder($attrsChain)
 {
     list($attr, $relPath) = $this->explodeRelation($attrsChain);
     $isRelation = $this->isRelation($attr);
     if (!$isRelation) {
         $attr = $attrsChain;
     }
     $field = $this->fieldByAttrForRequestOrder($attr);
     if (!is_null($relPath) && $isRelation) {
         return $field . '.' . $this->getGatewayByRelAttr($attr)->fieldByAttrChainForOrder($relPath);
     }
     if (is_null($relPath) && $isRelation) {
         if (Enum::className() == $this->getGatewayByRelAttr($attr)->className()) {
             $field = str_replace('PROPERTY_', 'PROPERTYSORT_', $field);
             return $field;
         }
     }
     if (!is_null($relPath) && !$isRelation) {
         $entityClass = $this->getEntityClass();
         throw new Exception("Attr call `{$attr}` as relation, but is not related for `{$entityClass}`");
     }
     if (is_null($relPath) && $isRelation) {
         throw new Exception("Sort call `{$attr}` without field");
     }
     return $field;
 }