2012-12-11 72 views

回答

1
  1. 從控制檯settings.yml中

    all: 
        use_database: true 
    
  2. 運行此命令

    php symfony configure:database "mysql:host=dbhost;dbname=yourdbname" dbuser dbpassword 
    
+0

是的感謝您的建議。那我該如何在行動課上調用它。 – Manivasagan

+0

@Manivasagan別忘了[請閱讀文檔](http://symfony.com/legacy/doc/gentle-introduction/1_4/en/08-Inside-the-Model-Layer-Doctrine)。 – j0k

+0

不,只需從控制檯運行一次,就像jOk所說的那樣,不要忘記[閱讀文檔](http://symfony.com/legacy/doc/gentle-introduction/1_4/en/08 - 內部最模型層 - 學說) – ilSavo

0

請檢查所有步驟進行數據庫連接symfony1.4

Step 1 : 

文件:配置/ ProjectConfiguration.class.php

find what: 
--------- 

public function setup() 
    { 
    $this->enablePlugins('owCorePlugin'); 
    } 

Repalce with : 
------------ 
public function setup() 
    { 
    $this->enablePlugins('owCorePlugin'); 
    $this->enablePlugins('sfDoctrinePlugin');  
    } 
Step 2 : 
config/databases.yml 
You need to create this file and add below code.replace caps letter with your details.You need to maintain same space also. 
all: 

教義: 類:sfDoctrineDatabase PARAM: DSN:MySQL的:主機= HOST_NAME; DBNAME = DB_NAME 用戶名:USERNAME 密碼:PASSWORD 第3步: 前端/配置/ settings.yml中

find what : 
use_database:   false 
Replace with 
use_database:   true 
Run the following command: 
change the project configuration.Make sure you need to run this command in root folder of our project 

PHP symfony的配置:數據庫--name =教義--class = sfDoctrineDatabase 「mysql:host = HOST_NAME; dbname = DB_NAME」USERNAME PASSWORD

step 5: schema files 
$ php symfony doctrine:build-schema 
$ php symfony doctrine:build-model 
$ php symfony doctrine:build-forms 
$ php symfony doctrine:build-filters 
$ ln -s lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web web/sfDoctrinePlugin 
相關問題