本文整理汇总了PHP中Doctrine_Lib::copyDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Lib::copyDirectory方法的具体用法?PHP Doctrine_Lib::copyDirectory怎么用?PHP Doctrine_Lib::copyDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Lib
的用法示例。
在下文中一共展示了Doctrine_Lib::copyDirectory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _generateModels
/**
* Generate a set of models for the schema information source
*
* @param string $prefix Prefix to generate the models with
* @param mixed $item The item to generate the models from
* @return string $path The path where the models were generated
* @throws Doctrine_Migration_Exception $e
*/
protected function _generateModels($prefix, $item)
{
$path = $this->_tmpPath . DIRECTORY_SEPARATOR . strtolower($prefix) . '_doctrine_tmp_dirs';
$options = array('classPrefix' => $prefix, 'generateBaseClasses' => false);
if (is_string($item) && file_exists($item)) {
$extension = $this->_getItemExtension($item);
if ($extension === 'yml') {
Doctrine_Core::generateModelsFromYaml($item, $path, $options);
return $path;
} else {
if ($extension === 'php') {
Doctrine_Lib::copyDirectory($item, $path);
return $path;
} else {
throw new Doctrine_Migration_Exception('No php or yml files found at path: "' . $item . '"');
}
}
} else {
try {
Doctrine_Core::generateModelsFromDb($path, (array) $item, $options);
return $path;
} catch (Exception $e) {
throw new Doctrine_Migration_Exception('Could not generate models from connection: ' . $e->getMessage());
}
}
}
示例2: _generateModels
/**
* Generate a set of models for the schema information source
*
* @param string $prefix Prefix to generate the models with
* @param mixed $item The item to generate the models from
* @return string $path The path where the models were generated
* @throws Doctrine_Migration_Exception $e
*/
protected function _generateModels($prefix, $item)
{
$path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . strtolower($prefix) . '_doctrine_tmp_dirs';
$options = array('classPrefix' => $prefix);
if (is_string($item) && file_exists($item)) {
if (is_dir($item)) {
$files = glob($item . DIRECTORY_SEPARATOR . '*.*');
} else {
$files = array($item);
}
if (isset($files[0])) {
$pathInfo = pathinfo($files[0]);
$extension = $pathInfo['extension'];
}
if ($extension === 'yml') {
Doctrine::generateModelsFromYaml($item, $path, $options);
return $path;
} else {
if ($extension === 'php') {
Doctrine_Lib::copyDirectory($item, $path);
return $path;
} else {
throw new Doctrine_Migration_Exception('No php or yml files found at path: "' . $item . '"');
}
}
} else {
try {
Doctrine::generateModelsFromDb($path, (array) $item, $options);
return $path;
} catch (Exception $e) {
throw new Doctrine_Migration_Exception('Could not generate models from connection: ' . $e->getMessage());
}
}
}