| 108 | | if (!array_key_exists($sRelationName,$aRelations) or !in_array($aRelations[$sRelationName][0],array(EntityORM::RELATION_TYPE_BELONGS_TO,EntityORM::RELATION_TYPE_HAS_ONE))) { |
| | 108 | $sRelType=$aRelations[$sRelationName][0]; |
| | 109 | $sRelEntity=$aRelations[$sRelationName][1]; |
| | 110 | $sRelKey=$aRelations[$sRelationName][2]; |
| | 111 | |
| | 112 | if (!array_key_exists($sRelationName,$aRelations) or !in_array($sRelType,array(EntityORM::RELATION_TYPE_BELONGS_TO,EntityORM::RELATION_TYPE_HAS_ONE))) { |
| 123 | | $aRelData=$this->GetItemsByArray(array('id'=>$aEntityKeys[$aRelations[$sRelationName][2]]),$aRelations[$sRelationName][1]); |
| 124 | | var_dump($aRelData); |
| 125 | | } |
| 126 | | /** |
| 127 | | * Собираем набор |
| 128 | | */ |
| | 129 | $sRelModuleName=Engine::GetModuleName($oRelEntityEmpty); |
| | 130 | $sRelEntityName=Engine::GetEntityName($oRelEntityEmpty); |
| | 131 | $sRelPluginPrefix=Engine::GetPluginPrefix($oRelEntityEmpty); |
| | 132 | // ItemsByArrayId - id пока идет костылем, т.к. у стандартных сущностей нет метода _GetPrimatyKey() |
| | 133 | $aRelData=Engine::GetInstance()->_CallModule("{$sRelPluginPrefix}{$sRelModuleName}_get{$sRelEntityName}ItemsByArrayId",array($aEntityKeys[$sRelKey])); |
| | 134 | /** |
| | 135 | * Собираем набор |
| | 136 | */ |
| | 137 | foreach ($aEntities as $oEntity) { |
| | 138 | if (isset($aRelData[$oEntity->_getDataOne($sRelKey)])) { |
| | 139 | $oEntity->_setData(array($sRelationName => $aRelData[$oEntity->_getDataOne($sRelKey)])); |
| | 140 | } |
| | 141 | } |
| | 142 | } |