/** * 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); }
/** * 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); }
<?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);
public static function createProxies(OutletConfig $config) { $gen = new OutletProxyGenerator($config); eval($gen->generate()); }
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)'); }