开发者

Using custom table name in Symfony plugin sfDoctrineGuardPlugin?

I'm attempting to use the sfDoctrineGuardPlugin in开发者_JAVA百科 my Symfony 1.4 project. This plugin includes a schema.yml file, which is used to define all the tables involved. The table names take on the form of: sf_guard_user, sf_guard_user_group, sf_guard_user_permission, etc. I'd rather have these tables be named: users, user_groups, user_permissions, etc. Is there a way for me to do this without editing the plugin code directly?


Override those things in your project's schema files:

sfGuardGroup:
  tableName: groups

sfGuardPermission:
  tableName: permissions

sfGuardGroupPermission:
  tableName: groups_permissions

Also, I'd prefer to move them into separate file, say sfDoctinePlugin-schema.yml.

Hope that helps.


Thats not a good practice, and i would discourage you from doing it.

With that said (and bolded, haha) you should be able to copy the included schema into your project level schema and add the tableName key to each record definition. I know that modify the schema in this way works generally speaking because i do it regularly to add extra columns to sfGuardUser instead of using a full blown profile class... i assume that modifying the table name would work as well.

That should after building the db you should see your table names. The thing is if there are cases in the actual plugin code where someone has hard coded the table name instead of using the alias defined in the model things may not work. I dont know that there are any situations like this, but you should test thoroughly before moving on with the project.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜