示例#1
0
 /**
  * Constructor
  */
 public function __construct($data = array())
 {
     if ($this->limit === null) {
         $config = new Config();
         $this->limit = $config->getConfig('application/display_limit');
         $thisClass = get_class($this);
         $thisClass = str_replace("App\\Model\\", "", $thisClass);
         $this->config = $config->readConfigFile('conf.d/table/' . $thisClass . '.yml');
         $this->table = $this->config['name'];
         $this->thisClass = $thisClass;
         $primaryKeys = array();
         foreach ($this->config['columns'] as $k => $v) {
             if (isset($v['primary_key']) && $v['primary_key'] === true) {
                 $primaryKeys[] = $k;
             }
         }
         if (count($primaryKeys) > 1) {
             $this->primaryKey = $primaryKeys;
         } else {
             $this->primaryKey = $primaryKeys[0];
         }
     }
     $this->db = new Database();
     foreach ($data as $obj => $value) {
         if (array_key_exists($obj, $this->config['columns'])) {
             $objName = 'set' . $this->underscoreToCamelCase($obj, true);
             $this->{$objName}($value);
         }
     }
 }
<?php

/**
* Transformatika Framework
*/
use Transformatika\Config\Config;
use Transformatika\MVC\RouteDispatcher;
Config::init(array('configExt' => 'yaml'));
/*
* Environment Setup
*/
if (Config::getConfig('env') === 'dev') {
    error_reporting(E_ALL);
    ini_set('display_errors', 'On');
} else {
    error_reporting(0);
    ini_set('display_errors', 'Off');
}
/*
* Initializing Propel ORM
*/
if (Config::getConfig('usePropel') == 'true' || Config::getConfig('usePropel') === true) {
    require_once 'propel.php';
}
$router = new RouteDispatcher(Config::readConfigFile('routing.yaml'));
$router->dispatch();