Ejemplo n.º 1
0
 /**
  * Load another model as a dependency of this one.
  *
  * @param string $model_name
  */
 function depend($model)
 {
     foreach (func_get_args() as $name) {
         if (isset($this->depends->{$name})) {
             continue;
         }
         $this->depends->{$name} =& Factory::model($name);
     }
 }
Ejemplo n.º 2
0
 /**
  * Instantiate one or more models and load them into the holder
  *
  * @param string $name,... Name(s) of model(s) to import
  */
 function import_model($name)
 {
     foreach (func_get_args() as $name) {
         $this->models->{$name} =& Factory::model($name);
         if ($this->models->{$name} === false) {
             trigger_error("Model {$name} does not exist");
             die;
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Load another model as a dependency of this one.
  *
  * @param string $model_name
  */
 function &depend($model)
 {
     foreach (func_get_args() as $name) {
         if (isset($this->depends->{$name})) {
             continue;
         }
         $this->depends->{$name} =& Factory::model($name);
     }
     // return a reference to the last model loaded
     return $this->depends->{$name};
 }
Ejemplo n.º 4
0
#!/usr/bin/env php
<?php 
/**
 * An example of a commandline script in Pronto.
 *
 */
@chdir(dirname($argv[0]) . '/..');
require_once 'profiles/cmdline.php';
$m_user =& Factory::model('user');
$users = $m_user->find("status='active'");
while ($u = $users->load_one()) {
    echo "{$u['email']}\n";
}
exit(0);