Exemplo n.º 1
0
 public function initView()
 {
     $view = Midori\Zend\View::get();
     $config = Midori\config();
     $view->setBasePath($config->paths->app)->setEncoding("utf8");
     return $view;
 }
Exemplo n.º 2
0
 public static function get()
 {
     if (self::$instance == null) {
         $config = \Midori\config();
         self::$instance = new View();
         self::$instance->fields = new Params();
     }
     return self::$instance;
 }
Exemplo n.º 3
0
 protected function initialize()
 {
     require File::join(MIDORI_ROOT . "config", "environment.php");
     $this->config = \Midori\config();
     $this->startLog();
     $this->startDataAccess();
     $this->startLayout();
     $this->startView();
     $this->startDispatcher();
 }
 public function validate($value, $object)
 {
     // if( $this->primaryKey == 0 || is_null($this->primaryKey))
     // 	return true;
     // if($value == '' || is_null($value))
     // 	return true;
     $adapter = Midori\config()->dataAdapter;
     $var = $adapter->selectOne("SELECT COUNT(*) FROM {$adapter->quoteIdentifier($object->tableName)} WHERE {$this->propertyName} = ? ", array($value));
     return $var == 0;
 }
Exemplo n.º 5
0
 public function __construct($tableName, $tableAlias, $primaryKey, $adapter = "default")
 {
     $this->tableName = $tableName;
     $this->tableAlias = $tableAlias;
     $this->primaryKey = $primaryKey;
     $config = Midori\config();
     if ($config->dataAdapter == null) {
         throw new \Midori\Exception('Midori_Environment::$defaultAdapter must be set in order to use active record');
     }
     $this->adapter = $config->dataAdapter;
 }