| @@ 242-255 (lines=14) @@ | ||
| 239 | case'selfMethod': |
|
| 240 | $type = $item->{$colInfo['colParams']['selfMethod']}(); |
|
| 241 | if (is_array($type)) { |
|
| 242 | if (strpos($type['relation'], ':')) { |
|
| 243 | $relationPath = explode(':', $type['relation']); |
|
| 244 | $relationName = array_pop($relationPath); |
|
| 245 | $curItem = $item; |
|
| 246 | foreach ($relationPath as $path) { |
|
| 247 | $curItem = $curItem->$path; |
|
| 248 | } |
|
| 249 | $itemModel = get_class($curItem); |
|
| 250 | $relation = $itemModel::getRelation($relationName); |
|
| 251 | $sourceModel = $relation['model']; |
|
| 252 | } else { |
|
| 253 | $relation = static::getRelation($type['relation']); |
|
| 254 | $sourceModel = $relation['model']; |
|
| 255 | } |
|
| 256 | $inputType = 'select'; |
|
| 257 | $value = $sourceModel::get($item->$colName); |
|
| 258 | if ($value) { |
|
| @@ 29-42 (lines=14) @@ | ||
| 26 | case'selfMethod': |
|
| 27 | $type = $this->model->{$col['selfMethod']}(); |
|
| 28 | if (is_array($type)) { |
|
| 29 | if (strpos($type['relation'], ':')) { |
|
| 30 | $relationPath = explode(':', $type['relation']); |
|
| 31 | $relationName = array_pop($relationPath); |
|
| 32 | $item = $this->model; |
|
| 33 | foreach ($relationPath as $path) { |
|
| 34 | $item = $item->$path; |
|
| 35 | } |
|
| 36 | $itemModel = get_class($item); |
|
| 37 | $relation = $itemModel::getRelation($relationName); |
|
| 38 | $sourceModel = $relation['model']; |
|
| 39 | } else { |
|
| 40 | $relation = $modelName::getRelation($type['relation']); |
|
| 41 | $sourceModel = $relation['model']; |
|
| 42 | } |
|
| 43 | $objectId = \App::$cur->migrations->findObject((string) $value, $sourceModel); |
|
| 44 | if ($objectId) { |
|
| 45 | $value = $objectId->object_id; |
|