src/xPDO/Om/xPDOObject.php
public static function _loadCollectionInstance(xPDO & $xpdo, array & $objCollection, $className, $criteria, $row, $fromCache, $cacheFlag=true) {
        $loaded = false;
        if ($obj= xPDOObject :: _loadInstance($xpdo, $className, $criteria, $row)) {
            if (($cacheKey= $obj->getPrimaryKey()) && !$obj->isLazy()) {
                if (is_array($cacheKey)) {
                    $pkval= implode('-', $cacheKey);
                } else {
                    $pkval= $cacheKey;
                }
                /* set OPT_CACHE_DB_COLLECTIONS to 2 to cache instances by primary key from collection result sets */
                if ($xpdo->getOption(xPDO::OPT_CACHE_DB_COLLECTIONS, array(), 1) == 2 && $xpdo->_cacheEnabled && $cacheFlag) {
                    if (!$fromCache) {
                        $pkCriteria = $xpdo->newQuery($className, $cacheKey, $cacheFlag);
                        $xpdo->toCache($pkCriteria, $obj, $cacheFlag);
                    } else {
                        $obj->_cacheFlag= true;
                    }
                }
                $objCollection[$pkval]= $obj;
                $loaded = true;
            } else {
                $objCollection[]= $obj;
                $loaded = true;
            }
        }
        return $loaded;
    }
public static function _loadCollectionInstance(xPDO & $xpdo, array & $objCollection, $className, $criteria, $row, $fromCache, $cacheFlag=true) {
        $loaded = false;
        if ($obj= xPDOObject :: _loadInstance($xpdo, $className, $criteria, $row)) {
            if (($cacheKey= $obj->getPrimaryKey()) && !$obj->isLazy()) {
                if (is_array($cacheKey)) {
                    $pkval= implode('-', $cacheKey);
                } else {
                    $pkval= $cacheKey;
                }
                /* set OPT_CACHE_DB_COLLECTIONS to 2 to cache instances by primary key from collection result sets */
                if ($xpdo->getOption(xPDO::OPT_CACHE_DB_COLLECTIONS, array(), 1) == 2 && $xpdo->_cacheEnabled && $cacheFlag) {
                    if (!$fromCache) {
                        $pkCriteria = $xpdo->newQuery($className, $cacheKey, $cacheFlag);
                        $xpdo->toCache($pkCriteria, $obj, $cacheFlag);
                    } else {
                        $obj->_cacheFlag= true;
                    }
                }
                $objCollection[$pkval]= $obj;
                $loaded = true;
            } else {
                $objCollection[]= $obj;
                $loaded = true;
            }
        }
        return $loaded;
    }
public static function _loadCollectionInstance ( xPDO & $ xpdo , array & $ objCollection , $ className , $ criteria , $ row , $ fromCache , $ cacheFlag = true ) { $ loaded = false ; if ( $ obj = xPDOObject :: _loadInstance ( $ xpdo , $ className , $ criteria , $ row ) ) { if ( ( $ cacheKey = $ obj -> getPrimaryKey ( ) ) && ! $ obj -> isLazy ( ) ) { if ( is_array ( $ cacheKey ) ) { $ pkval = implode ( '-' , $ cacheKey ) ; } else { $ pkval = $ cacheKey ; } /* set OPT_CACHE_DB_COLLECTIONS to 2 to cache instances by primary key from collection result sets */ if ( $ xpdo -> getOption ( xPDO :: OPT_CACHE_DB_COLLECTIONS , array ( ) , 1 ) == 2 && $ xpdo -> _cacheEnabled && $ cacheFlag ) { if ( ! $ fromCache ) { $ pkCriteria = $ xpdo -> newQuery ( $ className , $ cacheKey , $ cacheFlag ) ; $ xpdo -> toCache ( $ pkCriteria , $ obj , $ cacheFlag ) ; } else { $ obj -> _cacheFlag = true ; } } $ objCollection [ $ pkval ] = $ obj ; $ loaded = true ; } else { $ objCollection [ ] = $ obj ; $ loaded = true ; } } return $ loaded ; }
Responsible for loading an instance into a collection.

@static
@param xPDO &$xpdo A valid xPDO instance.
@param array &$objCollection The collection to load the instance into.
@param string $className Name of the class.
@param mixed $criteria A valid primary key, criteria array, or xPDOCriteria instance.
@param array $row The associative array containing the instance data.
@param bool $fromCache If the instance is for the cache
@param bool|int $cacheFlag Indicates if the objects should be cached and
optionally, by specifying an integer value, for how many seconds.
@return bool True if a valid instance was loaded, false otherwise.
Responsible for loading an instance into a collection .