This commit is contained in:
2020-09-08 10:26:34 +08:00
parent e7e13e9f8b
commit 10133953c3
+6 -1
View File
@@ -110,10 +110,15 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
if (!$this->offsetExists($offset)) { if (!$this->offsetExists($offset)) {
return NULL; return NULL;
} }
/** @var ActiveRecord $model */
if ($this->_item[$offset] instanceof ActiveRecord) {
return $this->_item[$offset]; return $this->_item[$offset];
} }
/** @var ActiveRecord $model */
return $this->model::populate($this->_item[$offset]);
}
/** /**
* @param mixed $offset * @param mixed $offset
* @param mixed $value * @param mixed $value