示例#1
0
 /**
  * executa as fixtures
  *
  * @return
  */
 public static function execute()
 {
     $objLoader = new \Doctrine\Common\DataFixtures\Loader();
     $objLoader->loadFromDirectory(FixtureLoader::ds_path);
     $objORMExecutor = new \Doctrine\Common\DataFixtures\Executor\ORMExecutor(Bootstrap::getServiceManager()->get('Doctrine\\ORM\\EntityManager'), self::getORMPurger());
     $objORMExecutor->execute($objLoader->getFixtures());
 }
示例#2
0
 private function getListaDeProcessos()
 {
     return Bootstrap::getServiceManager()->get('Doctrine\\ORM\\EntityManager')->getRepository('Application\\Entity\\Processo')->createQueryBuilder('e')->select('e')->getQuery()->getResult(\Doctrine\ORM\Query::HYDRATE_ARRAY);
 }
示例#3
0
文件: Bootstrap.php 项目: adrwtr/tqc
    }
    protected static function initAutoloader()
    {
        $vendorPath = static::findParentPath('vendor');
        if (is_readable($vendorPath . '/autoload.php')) {
            $loader = (include $vendorPath . '/autoload.php');
        } else {
            $zf2Path = getenv('ZF2_PATH') ?: (defined('ZF2_PATH') ? ZF2_PATH : (is_dir($vendorPath . '/ZF2/library') ? $vendorPath . '/ZF2/library' : false));
            if (!$zf2Path) {
                throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.');
            }
            include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
        }
        AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__))));
    }
    protected static function findParentPath($path)
    {
        $dir = __DIR__;
        $previousDir = '.';
        while (!is_dir($dir . '/' . $path)) {
            $dir = dirname($dir);
            if ($previousDir === $dir) {
                return false;
            }
            $previousDir = $dir;
        }
        return $dir . '/' . $path;
    }
}
Bootstrap::init();