Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: 49aa9810dd
...
compare: d9ee314ef9
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 13, 2012
@opengeek opengeek [#7607] xPDOObject->get(array) triggering invalid lazy loading ea6b250
@opengeek opengeek - Fix lazy loading of fields on demand
xPDOObject->_loadFieldData() was broken by a change to xPDOObject::_loadRows()
32c54ff
@opengeek opengeek Merge remote-tracking branch 'xpdo/develop' into develop
* xpdo/develop:
  - Fix lazy loading of fields on demand
  [#7607] xPDOObject->get(array) triggering invalid lazy loading
d9ee314
Showing with 7 additions and 3 deletions.
  1. +2 −0  changelog.txt
  2. +5 −3 om/xpdoobject.class.php
View
2  changelog.txt
@@ -1,5 +1,7 @@
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
8 om/xpdoobject.class.php
@@ -918,8 +918,9 @@ public function set($k, $v= null, $vType= '') {
public function get($k, $format = null, $formatTemplate= null) {
$value= null;
if (is_array($k)) {
- if ($this->isLazy()) {
- $this->_loadFieldData($k);
+ $lazy = array_intersect($k, $this->_lazy);
+ if ($lazy) {
+ $this->_loadFieldData($lazy);
}
foreach ($k as $key) {
if (array_key_exists($key, $this->_fields)) {
@@ -2365,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);
}

No commit comments for this range

Something went wrong with that request. Please try again.