Open potfur opened 9 years ago
Very nice. A few questions/comments:
User
entity, but blog module can contain post
, tag
, comment
and comments author
- all entities.@potfur I have question about module's bootstrap file. What exactly this mean? Is it just simple array or something more complex eg class with common interface?
@seclu Simple array - look at current boostrap.php
files. Soon I will implement auth module - as example for other modules.
@potfur Ok, I understand. I'm not sure that this solution is enough good. I think that good and safe boundary for every module is common interface. In other hand I don't have any strong argument against array :) IMHO interface is just more flexible and programmer friendly.
I think I would also prefer a ModuleInterface where we ensure a certain structure. Currently I don't know yet what the bootstrap should do or return :smiley:
Bootstrap is always a configuration array - same as described in Moss config.
I am very much in favour of an interface. I think we should find a way to do that. It does not really matter if Moss natively uses arrays, we can still abstract that to an object if we think it is better. Ideally, I think we should always know what the Module Config will return, and then give that to Moss in the format that it wants it. Moreover, this is the Vox Module bootstrap we are talking about, not Moss's. At any point we might need to add or change stuff in that config, and we should not be too attached to what Moss expects.
Maybe something like this:
interface VoxModuleInterface {
public function name();
public function ver();
public function registerConfigVars(ConfigInterface $config);
public function registerComponents(ContainerInterface $container);
public function registerEventListeners(ConfigInterface $dispatcher);
public function registerRoutes(RouterInterface $router);
}
This is just a rough sketch, probably there will be more registerSomething
methods eg. registerModels
for DBs.
We should define directory structure that will be used in modules/packages/bundles (or whatever name we will use) - what is the name of directory with controllers, models, repositories and stuff. Also should we use always singular or plural?
My proposition is like this:
Where
module
is the name of ... module.end
isfrontend
/backend
/otherend
directory. This means that we have a module which supports frontend and backend or just backend functionality./Entity/
is a directory for entities, ie.Post
,User
etc./Controller/
for controllers for set*end
,/Model/
ideally only models should contain logic, but ... we won't have complex logic/Repository/
classes that have access to database/Resource/
all stuff that should be copied from module to public directory ie. images, css, fonts etc./View/
view templates