Permalink
Browse files

- Fix lazy loading of fields on demand

xPDOObject->_loadFieldData() was broken by a change to xPDOObject::_loadRows()
  • Loading branch information...
1 parent ea6b250 commit 32c54ff59e888ea806949447ac3902765bbd65c6 @opengeek opengeek committed Apr 13, 2012
Showing with 3 additions and 1 deletion.
  1. +1 −0 xpdo/changelog.txt
  2. +2 −1 xpdo/om/xpdoobject.class.php
View
1 xpdo/changelog.txt
@@ -1,5 +1,6 @@
This file shows the changes in this release of xPDO.
+- Fix lazy loading of fields on demand
- [#7607] xPDOObject->get(array) triggering invalid lazy loading
- xPDOObject/xPDOSimpleObject support for xPDO::getDescendants()
- Refactor HYDRATE_FIELDS/HYDRATE_RELATED_OBJECTS using __get()/__set()
View
3 xpdo/om/xpdoobject.class.php
@@ -2366,7 +2366,8 @@ protected function _loadFieldData($fields) {
$criteria= $this->xpdo->newQuery($this->_class, $this->getPrimaryKey());
$criteria->select($fields);
if ($rows= xPDOObject :: _loadRows($this->xpdo, $this->_class, $criteria)) {
- $row= reset($rows);
+ $row= $rows->fetch(PDO::FETCH_ASSOC);
+ $rows->closeCursor();
$this->fromArray($row, '', false, true);
$this->_lazy= array_diff($this->_lazy, $fields);
}

0 comments on commit 32c54ff

Please sign in to comment.