ActiveRecord\Table::load PHP Method

load() public static method

public static load ( $model_class_name )
    public static function load($model_class_name)
    {
        if (!isset(self::$cache[$model_class_name])) {
            /* do not place set_assoc in constructor..it will lead to infinite loop due to
               relationships requesting the model's table, but the cache hasn't been set yet */
            self::$cache[$model_class_name] = new Table($model_class_name);
            self::$cache[$model_class_name]->set_associations();
        }
        return self::$cache[$model_class_name];
    }

Usage Example

Esempio n. 1
0
 public function __get($name)
 {
     if ($name === 'primary_key' && !isset($this->primary_key)) {
         $this->primary_key = [Table::load($this->class_name)->pk[0]];
     }
     return $this->{$name};
 }
All Usage Examples Of ActiveRecord\Table::load