Exemplo n.º 1
0
 /**
  * Generate the proxy classes that will perform the actual work
  * 
  * This method creates a string with the class definitions and then
  * uses eval to create them. For better performance it's recommented
  * that, instead of calling this method, you use the outletgen.php 
  * script to generate the proxies and include them directly. This will
  * allow byte-code caches to cache the proxies code. 
  */
 public function createProxies()
 {
     require_once 'OutletProxyGenerator.php';
     $gen = new OutletProxyGenerator($this->config);
     $c = $gen->generate();
     eval($c);
     // set outlet
     $c = '';
     foreach ($this->config->getEntities() as $en) {
         $cls = $en->clazz . '_OutletProxy';
         $c .= "{$cls}::\$_outlet = \$this;\n";
     }
     eval($c);
 }
Exemplo n.º 2
0
 /**
  * Generate the proxy classes that will perform the actual work
  * 
  * This method creates a string with the class definitions and then
  * uses eval to create them. For better performance it's recommented
  * that, instead of calling this method, you use the outletgen.php 
  * script to generate the proxies and include them directly. This will
  * allow byte-code caches to cache the proxies code. 
  */
 public function createProxies()
 {
     require_once 'OutletProxyGenerator.php';
     $gen = new OutletProxyGenerator($this->config);
     $c = $gen->generate();
     eval($c);
 }
Exemplo n.º 3
0
<?php

set_include_path(dirname(__FILE__) . '/..' . PATH_SEPARATOR . get_include_path());
require 'outlet/Outlet.php';
require 'outlet/OutletProxyGenerator.php';
Outlet::init(require $_SERVER['argv'][1]);
$conf = (require $_SERVER['argv'][1]);
$gen = new OutletProxyGenerator(Outlet::getInstance()->getConfig());
$s = "<?php\n";
$s .= $gen->generate();
file_put_contents('outlet-proxies.php', $s);
Exemplo n.º 4
0
 public static function createProxies(OutletConfig $config)
 {
     $gen = new OutletProxyGenerator($config);
     eval($gen->generate());
 }
Exemplo n.º 5
0
 protected function initialize()
 {
     require_once dirname(__FILE__) . '/../classes/outlet/Outlet.php';
     $this->pdo = new PDO('sqlite::memory:');
     $config = array('connection' => array('pdo' => $this->pdo, 'dialect' => 'sqlite'), 'classes' => array('User' => array('table' => 'users', 'props' => array('id' => array('id', 'int', array('pk' => true)), 'name' => array('name', 'varchar')), 'useGettersAndSetters' => false)));
     $config = new OutletConfig($config);
     $proxyGenerator = new OutletProxyGenerator($config);
     eval($proxyGenerator->generate());
     $this->outletSession = Outlet::openSession($config);
     $this->pdo->exec('CREATE TABLE users (id INTEGER, name TEXT)');
 }