SwatDB/SwatDBRecordsetWrapper.php
public function load($object_indexes)
    {
        if (!is_array($object_indexes)) {
            throw new SwatInvalidTypeException(
                'The $object_indexes property must be an array.',
                0,
                $object_indexes
            );
        }

        $interfaces = class_implements($this->row_wrapper_class);
        if (!in_array('SwatDBRecordable', $interfaces)) {
            throw new SwatInvalidClassException(
                'The recordset must define a row wrapper class that is an ' .
                    'instance of SwatDBRecordable for recordset loading to work.',
                0,
                $this->row_wrapper_class
            );
        }

        $success = true;

        // try to load all records
        $records = array();
        $class_name = $this->row_wrapper_class;
        foreach ($object_indexes as $index) {
            $record = new $class_name();
            $record->setDatabase($this->db);
            if ($record->load($index)) {
                $records[] = $record;
            } else {
                $success = false;
                break;
            }
        }

        // successfully loaded all records, set this set's records to the
        // loaded records
        if ($success) {
            $this->objects = array();
            $this->objects_by_index = array();
            $this->removed_objects = array();

            foreach ($records as $record) {
                $this[] = $record;
            }

            $this->reindex();
        }

        return $success;
    }
public function load($object_indexes)
    {
        if (!is_array($object_indexes)) {
            throw new SwatInvalidTypeException(
                'The $object_indexes property must be an array.',
                0,
                $object_indexes
            );
        }

        $interfaces = class_implements($this->row_wrapper_class);
        if (!in_array('SwatDBRecordable', $interfaces)) {
            throw new SwatInvalidClassException(
                'The recordset must define a row wrapper class that is an ' .
                    'instance of SwatDBRecordable for recordset loading to work.',
                0,
                $this->row_wrapper_class
            );
        }

        $success = true;

        // try to load all records
        $records = array();
        $class_name = $this->row_wrapper_class;
        foreach ($object_indexes as $index) {
            $record = new $class_name();
            $record->setDatabase($this->db);
            if ($record->load($index)) {
                $records[] = $record;
            } else {
                $success = false;
                break;
            }
        }

        // successfully loaded all records, set this set's records to the
        // loaded records
        if ($success) {
            $this->objects = array();
            $this->objects_by_index = array();
            $this->removed_objects = array();

            foreach ($records as $record) {
                $this[] = $record;
            }

            $this->reindex();
        }

        return $success;
    }
public function load ( $ object_indexes ) { if ( ! is_array ( $ object_indexes ) ) { throw new SwatInvalidTypeException ( 'The $object_indexes property must be an array.' , 0 , $ object_indexes ) ; } $ interfaces = class_implements ( $ this -> row_wrapper_class ) ; if ( ! in_array ( 'SwatDBRecordable' , $ interfaces ) ) { throw new SwatInvalidClassException ( 'The recordset must define a row wrapper class that is an ' . 'instance of SwatDBRecordable for recordset loading to work.' , 0 , $ this -> row_wrapper_class ) ; } $ success = true ; // try to load all records $ records = array ( ) ; $ class_name = $ this -> row_wrapper_class ; foreach ( $ object_indexes as $ index ) { $ record = new $ class_name ( ) ; $ record -> setDatabase ( $ this -> db ) ; if ( $ record -> load ( $ index ) ) { $ records [ ] = $ record ; } else { $ success = false ; break ; } } // successfully loaded all records, set this set's records to the // loaded records if ( $ success ) { $ this -> objects = array ( ) ; $ this -> objects_by_index = array ( ) ; $ this -> removed_objects = array ( ) ; foreach ( $ records as $ record ) { $ this [ ] = $ record ; } $ this -> reindex ( ) ; } return $ success ; }
Loads a set of records into this recordset

It is recommended for performance that you use recordset wrappers to
wrap a MDB2 result set rather than using this load() method. Using this
method performs N queries where N is the size of the passed array of
object indexes.

@param array $object_indexes the index field values of the records to
load into this recordset.

@return boolean true if all records loaded properly and false if one
or more records could not be loaded. If any records
fail to load, the recordset state remains unchanged.

@throws SwatInvalidTypeException if the <i>$object_indexes</i> property
is not an array.
@throws SwatInvalidClassException if this recordset's
{@link SwatDBRecordsetWrapper::$row_wrapper_class}
is not an instance of
{@link SwatDBRecordable}.
Loads a set of records into this recordset