本文整理匯總了PHP中Doctrine_Core::compile方法的典型用法代碼示例。如果您正苦於以下問題:PHP Doctrine_Core::compile方法的具體用法?PHP Doctrine_Core::compile怎麽用?PHP Doctrine_Core::compile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine_Core
的用法示例。
在下文中一共展示了Doctrine_Core::compile方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
public function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager($this->configuration);
$message = 'Compiling the Doctrine core';
if ($options['driver']) {
$message .= ' with driver(s) "' . implode('", "', $options['driver']) . '"';
}
$this->logSection('doctrine', $message);
$target = Doctrine_Core::compile($arguments['target'], $options['driver']);
$target = realpath($target);
$targetPhp = var_export($target, true);
foreach (array('sf_symfony_lib_dir', 'sf_lib_dir', 'sf_root_dir') as $name) {
$path = sfConfig::get($name);
if (0 === strpos($target, $path)) {
$targetPhp = "sfConfig::get('{$name}')." . var_export(substr($target, strlen($path)), true);
break;
}
}
$this->log(<<<EOF
Doctrine compilation complete. Add the following code to ProjectConfiguration:
public function setup()
{
// ...
if (\$this instanceof sfApplicationConfiguration && !\$this->isDebug())
{
require_once {$targetPhp};
}
}
EOF
);
}
示例2: execute
/**
* @see sfTask
*/
protected function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager($this->configuration);
$compiledFile = sfConfig::get('sf_cache_dir') . '/doctrine.compiled.php';
if (file_exists($compiledFile)) {
$this->logSection('error', $compiledFile . ' already exists', null, 'ERROR');
$this->logBlock('Run symfony:cache-clear first', 'INFO');
return;
}
$drivers = array();
foreach ($databaseManager->getNames() as $name) {
$drivers[] = strtolower($databaseManager->getDatabase($name)->getDoctrineConnection()->getDriverName());
}
$drivers = array_unique($drivers);
$this->logSection('compile', 'Included drivers: ' . implode(', ', $drivers));
Doctrine_Core::compile($compiledFile, $drivers);
$this->logSection('file+', $compiledFile);
}
示例3: execute
public function execute()
{
$compiledPath = Doctrine_Core::compile($this->getArgument('compiled_path'), $this->getArgument('drivers', array()));
$this->notify('Compiled Doctrine successfully to: ' . $compiledPath);
}