protected function getContainer() { if (!$this->_container) { /** @var $loader Composer\Autoload\ClassLoader */ $loader = (require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/vendor/autoload.php'); $configurator = new \Venne\Config\Configurator(dirname(dirname(dirname(dirname(__DIR__)))) . '/app', $loader); $configurator->enableDebugger(); $configurator->enableLoader(); $this->_container = $configurator->getContainer(); } return $this->_container; }
<?php /** * This file is part of the Venne:CMS (https://github.com/Venne) * * Copyright (c) 2011, 2012 Josef Kříž (http://www.josef-kriz.cz) * * For the full copyright and license information, please view * the file license.txt that was distributed with this source code. */ if (file_exists(__DIR__ . '/../../../autoload.php')) { /** @var $loader Composer\Autoload\ClassLoader */ $loader = (require_once __DIR__ . '/../../../autoload.php'); $sandbox = dirname(dirname(dirname(dirname(__DIR__)))); } elseif (file_exists(__DIR__ . '/../autoload.php')) { /** @var $loader Composer\Autoload\ClassLoader */ $loader = (require_once __DIR__ . '/../autoload.php'); $sandbox = dirname(dirname(__DIR__)); } else { die('autoload.php file can not be found.'); } // create and run application $configurator = new \Venne\Config\Configurator($sandbox . '/app', $loader); $configurator->enableDebugger(); $configurator->enableLoader(); $configurator->getContainer()->application->run();
function csv($fileName, $colNames) { $dataIndexed = array_map('str_getcsv', array_map('trim', explode("\n", file_get_contents($fileName)))); $cols = parseCols($colNames); $data = array_map(function ($indexedRow) use($cols) { return array_combine($cols, $indexedRow); }, $dataIndexed); return function () use($cols, $data) { return (object) array('data' => $data, 'columns' => $cols); }; } } namespace { $loader = (require_once __DIR__ . '/../../vendor/autoload.php'); header('Content-Type: text/plain; charset=utf-8'); // create and run application $configurator = new \Venne\Config\Configurator(__DIR__ . '/../../app', $loader); $configurator->enableDebugger(); $configurator->enableLoader(); //\Nette\Diagnostics\Debugger::enable('development', __DIR__ . '/../../app/log'); /** @var \Doctrine\ORM\EntityManager $db */ $db = $configurator->createContainer()->entityManager; use V6ak\DB\Export\Exporter; $rules = (require __DIR__ . '/../../export/export-db.cfg.php'); $e = new Exporter($db); $exportResults = $e->exportByRules($rules, false); foreach ($exportResults->errors as $error) { echo "WARNING: {$error}\n"; } echo implode(";\n\n", $exportResults->data); }