Symfony - sfDoctrineGuard - Share Model Files Between two Symfony Projects
Afternoon. I am working on multiple symfony projects which will share the same user database, and because I didn't want to re-invent the wheel I opted to use sfDoctrineGuard. I have a corelib that the symfony applications both have access too, so I want to move the sfDoctrineGuard model, filter, and forms files into the shared directory. This will ensure that both applications have access to the files, and also alleviate the issue where I would have to rebuild the model files for each project.开发者_C百科
Has anyone tried this before?
If you want to share code across multiple projects, use a plugin.
Create a plugin with a shared sfGuardUser
object, e.g. sharedSfGuardUser
, that extends PluginsfGuardUser
.
Then, in each individual project, update sfGuardUser
so that it extends sharedSfGuardUser
instead of PluginsfGuardUser
.
Figured it out. I just added an autoload.yml file to the config/ dir and told symfony where to look for shared model files. Had to do this for both symfony projects, but worked great! Just need to figure out a way to disable building model files for all but one of the projects.
精彩评论