/**
  * Populate the member variables of the object from the database.
  * @param I2CE_Form $form
  */
 public function populate($form)
 {
     $fields = array();
     foreach ($form as $field => $fieldObj) {
         if (!$fieldObj->isInDB()) {
             continue;
         }
         $fields[] = $field;
     }
     $fields[] = 'last_modified';
     $fields[] = 'created';
     $populateQry = $this->getRequiredFieldsQuery($form->getName(), $fields, $form->getId(), true);
     if (!$populateQry) {
         return false;
     }
     $populateQry .= ' LIMIT 1';
     $result = $this->db->getRow($populateQry);
     if (I2CE::pearError($result, "Error populating form " . $form->getName())) {
         return false;
     }
     $form_name = $form->getName();
     foreach ($fields as $field) {
         $fieldObj = $form->getField($field);
         if (!$fieldObj instanceof I2CE_FormField) {
             continue;
         }
         $ref = strtolower($form_name . '+' . $field);
         if (isset($result->{$ref})) {
             $fieldObj->setFromDB($result->{$ref});
         }
     }
     $ref = strtolower($form_name . '+parent');
     if (isset($result->{$ref})) {
         $form->setParent($result->{$ref});
     }
     $ref = strtolower($form_name . '+last_modified');
     if (isset($result->{$ref})) {
         $form->setLastModified($result->{$ref});
     }
     $ref = strtolower($form_name . '+created');
     if (isset($result->{$ref})) {
         $form->setCreated($result->{$ref});
     }
     return true;
 }