1 新建立工程
D:\xampp\htdocs\mycms>D:\symfony\data\bin\symfony generate:project mycms
2 创建前台和后台
D:\xampp\htdocs\mycms>D:\symfony\data\bin\symfony generate:app frontend
D:\xampp\htdocs\mycms>D:\symfony\data\bin\symfony generate:app backend
3 生成model表单模型
D:\xampp\htdocs\mycms>D:\symfony\data\bin\symfony doctrine:build --all
4 从data下填充数据库到数据库
D:\xampp\htdocs\mycms>D:\symfony\data\bin\symfony doctrine:generate-module frontend job Job --with-show --non-verbose-template
5 生成后台action及模版
D:\xampp\htdocs\mycms>D:\symfony\data\bin\symfony doctrine:generate-admin backend Category
D:\xampp\htdocs\mycms>D:\symfony\data\bin\symfony doctrine:generate-admin backend Content
D:\xampp\htdocs\mycms>D:\symfony\data\bin\symfony doctrine:generate-admin backend Comment
6 格式化后台程序的输出
D:\xampp\htdocs\mycms>D:\symfony\data\bin\symfony plugin:publish-assets
7 创建前台程序
D:\xampp\htdocs\mycms>symfony doctrine:generate-module frontend category Category --with-show
D:\xampp\htdocs\mycms>symfony doctrine:generate-module frontend content Content --with-show
D:\xampp\htdocs\mycms>symfony doctrine:generate-module frontend comment Comment --with-show
8 目前位置一个带有前台和后台的应用程序已经全部好了。
//---------------------------yml 应用程序的数据库 ---------------------------------
Category:
columns:
name: string(50)
description: string(1000)
Content:
actAs:
Timestampable: ~
columns:
title: string(255)
body: clob
view_count: integer
recommend_level:
type: enum
values: [0,1,2]
default: 2
category_id: integer
relations:
Category:
local: category_id
foreign: id
foreignAlias: Contents
Comment:
columns:
body: clob
user_id: integer
content_id: integer
relations:
Content:
local: content_id
foreign: id
foreignAlias: Comments
//---------------------------yml 应用程序的后台样式 ---------------------------------
generator:
class: sfDoctrineGenerator
param:
model_class: category
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: category
with_doctrine_route: true
actions_base_class: sfActions
config:
actions:
_delete:
label: 删除
_list:
label: 返回管理
fields:
id:
label: 编号
name:
label: 名字
description:
label: 描述
list:
title: 信息管理
display: [id,=name,description]
layout: stacked
#params: 编号:%%id%%<br />名字:%%name%%<br />描述:%%description%%<br />
sort: [title,view_count,category, DESC]
max_per_page: 6
batch_actions:
_delete:
label: 删除
publish:
label: 发布
object_actions:
_edit:
label: 编辑
_delete:
label: 删除
publish:
label: 发布
actions:
_new:
label: 创建
filter: ~
form: ~
edit: ~
new: ~