最近,我一直在探索 Symfony 的 sfDoctrineGenerator 用于我的后端接口。问题是这样的:
我正在使用 sfDoctrineGuardPlugin 进行用户管理。sfGuardUser 模块使用 sfDoctrineGenerator。所有需要的功能(删除、编辑、添加)都在工作。到目前为止,一切都很好。
然后,我使用此链接作为参考创建了一个新模块。添加和编辑功能现在可以工作,但我无法使删除(批量和单次删除)工作。我试图在批处理操作下显式添加它,但它仍然不起作用。它说它已经删除,显示一条消息成功,但没有删除任何元素。有人可以指出问题可能起源的正确方向吗?
这是我的 generator.yml 的副本
generator:
class: sfDoctrineGenerator
param:
model_class: News
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: news
with_doctrine_route: true
actions_base_class: sfActions
config:
actions: ~
fields:
news: {label: Announcement}
created_at: {label: Date Published}
updated_at: {label: Date Updated}
user_id: {label: Author}
user_name: {label: Author}
list:
title: Announcements List
display: [=title, created_at, updated_at, user_name]
sort: [created_at, desc]
max_per_page: 10
batch_actions:
_delete: ~
filter:
display: [title, user_id]
form:
class: NewsForm
edit:
title: Editing Announcement "%%title%%"
new:
title: New Announcement
如果您需要我的其他东西,请随时发表评论。任何帮助都感激不尽。提前致谢。
更新:
这是在 Chrome 中查看的请求标头:
Request URL:http://localhost:8080/inventory_dev.php/news
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Cookie:ja_purity_tpl=ja_purity; fontSize=100; __atuvc=312|19; JSESSIONID=9DDD204812F0C53A8B3D33B89BF7A7C8; matciis=ha6l8ci8h3i2bp696e4h33vig2; symfony=ld2qept3j5cddjsb16qie098u3
Host:localhost:8080
Referer:http://localhost:8080/inventory_dev.php/news
User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5
Response Headersview source
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:Keep-Alive
Content-Type:text/html; charset=utf-8
Date:Wed, 30 May 2012 08:30:02 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:timeout=5, max=99
Pragma:no-cache
Server:Apache/2.2.21 (Win32) PHP/5.3.8
Transfer-Encoding:chunked
X-Powered-By:PHP/5.3.8