symfony由0.63升级到1.0成功
首先用pear config-show命令 ,查看一下相应的路径是否正确。
如果不正确,先修正一下。
用pear upgrade symfony/symfony升级到symfony 1.0
对于0.63的老项目升级,进入项目目录,更改项目目录下的symfony文件,添加内容如下:
#!/usr/bin/env php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
chdir(dirname(__FILE__));
include('config/config.php');
include($sf_symfony_data_dir.'/bin/symfony.php');
修改项目目录下的config/config.php文件,添加如下:
// symfony directories
$sf_symfony_lib_dir = 'D:\php-5.1.6-Win32\pear/symfony';
$sf_symfony_data_dir = 'D:\php-5.1.6-Win32\pear\data/symfony';
执行
symfony upgrade 1.0
symfony propel-build-model
symfony cc
如果老项目的模版页面使用过form_error函数,那么在模版页面上添加
use_helper('Validation')
在action中如果使用过$this->addJavascript('css');这样的语句要修改成
$response = $this->getResponse();
$response->addJavascript('css');
至此,symfony及老项目就都升级到1.0版本了。