You are here

class SimpleActiveRecord in Rotating Banner 7

Same name and namespace in other branches
  1. 7.2 rotating_banner.classes.inc \SimpleActiveRecord

Hierarchy

Expanded class hierarchy of SimpleActiveRecord

File

./rotating_banner.classes.inc, line 258

View source
class SimpleActiveRecord {
  public function setValuesFromArray($array) {
    foreach ($this
      ->dbFields() as $field_name) {
      if (isset($array[$field_name])) {
        $this->{$field_name} = $array[$field_name];
      }
    }
  }

  /**
   * Disclaimer: This is a hack.  The PDO::FETCH_CLASS does not behave as
   * documented.  It is supposed to run the constructor *after* the properties
   * have been assigned and in some versions of PHP, it does that.
   *
   * However, as of http://bugs.php.net/bug.php?id=46292, it does not.  This method
   * receives a list of Objects and runs a ->initialize() method on them.  This
   * is basically another constructor which can be run afterwards.
   */
  public static function runInitialize(&$result) {
    foreach ($result as &$row) {
      $row
        ->initialize();
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SimpleActiveRecord::runInitialize public static function Disclaimer: This is a hack. The PDO::FETCH_CLASS does not behave as documented. It is supposed to run the constructor *after* the properties have been assigned and in some versions of PHP, it does that.
SimpleActiveRecord::setValuesFromArray public function