-
-
Notifications
You must be signed in to change notification settings - Fork 324
Rename ContainerBuilder::compile() #506
Description
From #494 (comment)
Suggestions:
setCompilationPath($filename): I'd like to avoid using setters if possibleenableCompilation($filename)
Please note that the file name will also be the name of the generated PHP class. Because of that the filename you specify must also be a valid class name
Wouldn't it be better just to use a single file name (CompiledContainer.php is just perfect) and let the user set the path only? (this plays better with my previous suggestion of setCompilationPath)
@juliangut I'm not sure I remember the whole reasons at the moment but I needed being able to set the file name for tests or scenarios where I wanted multiple containers. In any case I think it's also a good thing to let users choose the path and the file name, it allows to avoid creating a directory just for one file, and it allows more control over that file. Users will need to manage that file specifically for their deployment, some others may want to commit it in the repository. If we ever changed the file name it could have bad consequences, I think it's simpler and saner to let users choose the whole file name instead of forcing their hand.