当前位置: 首页>>代码示例>>PHP>>正文


PHP Factory::toFile方法代码示例

本文整理汇总了PHP中Zend\Config\Factory::toFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::toFile方法的具体用法?PHP Factory::toFile怎么用?PHP Factory::toFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Config\Factory的用法示例。


在下文中一共展示了Factory::toFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateConfig

 private function generateConfig()
 {
     $path = "module/{$this->module}/config/table.config.php";
     if (file_exists($path)) {
         copy($path, $path . '.' . date('mdHis'));
         $config = (include $path);
     } else {
         $config = ['tables' => []];
     }
     $itemConfig = ['table' => $this->table];
     if ($this->params('db')) {
         $itemConfig['adapter'] = $this->params('db');
     }
     if ($this->params('schema')) {
         $itemConfig['schema'] = $this->params('schema');
     }
     if ($this->params('t')) {
         $itemConfig['invokable'] = "{$this->module}\\Model\\{$this->name}Table";
     }
     if ($this->params('e')) {
         $itemConfig['row'] = "{$this->module}\\Model\\{$this->name}";
     }
     if ($this->params('re')) {
         $itemConfig['row'] = true;
     }
     $primaries = [];
     foreach ($this->getTableMeta()->getConstraints($this->table, $this->schema) as $constraint) {
         /** @var $constraint \Zend\Db\Metadata\Object\ConstraintObject */
         if ($constraint->getType() == 'PRIMARY KEY') {
             $primaries[] = current($constraint->getColumns());
         }
     }
     if (count($primaries) == 1) {
         $primaries = current($primaries);
     }
     $itemConfig['primary'] = $primaries;
     $config['tables'][$this->name . 'Table'] = $itemConfig;
     ConfigFactory::toFile($path, $config);
     echo 'Generate config success!';
 }
开发者ID:moln,项目名称:gzfextra,代码行数:40,代码来源:ConsoleController.php

示例2: testFactoryCanRegisterCustomWriterPlugin

 public function testFactoryCanRegisterCustomWriterPlugin()
 {
     $dummyWriter = new Writer\TestAssets\DummyWriter();
     Factory::getWriterPluginManager()->setService('DummyWriter', $dummyWriter);
     Factory::registerWriter('dum', 'DummyWriter');
     $file = $this->getTestAssetFileName('dum');
     $res = Factory::toFile($file, array('one' => 1));
     $this->assertEquals($res, true);
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:9,代码来源:FactoryTest.php

示例3: getenv

<?php

use Zend\Config\Factory;
$env = getenv('APP_ENV') ?: 'dev';
$mergedConfigFile = __DIR__ . '/../data/cache/config_cache.php';
// If in production and merged config exists, return it
if ($env === 'pro' && is_file($mergedConfigFile)) {
    return include $mergedConfigFile;
}
// Merge configuration files
$mergedConfig = Factory::fromFiles(glob(__DIR__ . '/autoload/{,*.}{global,local}.php', GLOB_BRACE));
// If in production, cache merged config
if ($env === 'pro') {
    Factory::toFile($mergedConfigFile, $mergedConfig);
}
// Finally, Return the merged configuration
return $mergedConfig;
开发者ID:acelaya,项目名称:alejandrocelaya.com,代码行数:17,代码来源:config.php


注:本文中的Zend\Config\Factory::toFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。