Symfony 自動產生背景程式

來源:互聯網
上載者:User

使用Symfony架構自身提供的後台產生器,對寫後台來說,是很大的福音。它減縮了很多工作,讓注意力放到了邏輯設計上。下面是主要流程:

 

 

  • 建立背景程式/管理模組
  • 建立產生背景程式的設定檔
  • 增加登陸模組
* 建立背景程式/管理模組

> symfony init-app backend
> symfony propel-init-admin backend post Post
> symfony propel-init-admin backend comment Comment

注意:產生管理模組與建立一般模組不同,一般模組init-module,而管理模組propel-init-admin.
其實這個與腳手架的建立類似:
    symfony propel-generate-crud frontend post Post
    symfony propel-generate-crud frontend comment Comment

* 建立產生背景程式的設定檔

設定檔位置:/apps/backend/modules/moduleName/config/generator.yml
具體配置資訊請參考 Symfony 權威指南14章。

* 增加登陸模組

> symfony init-module backend security
編輯apps/backend/modules/post/config/security.yml
all:
–is_secure: on

在檔案apps/backend/modules/security/templates/indexSuccess.php中,增加登陸表單。
在檔案apps/backend/modules/security/actions/actions.class.php中,增加login方法。
在檔案apps/backend/config/settings.yml中,設定登陸模組:
all:
  .actions:
      login_module:     security
        login_action:     index

That is All!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.