本文整理匯總了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());
}
}
}