doctrine regenerating models from yml only the base models?
I am wondering if there is a way to handle this more elegantly.
After generating the "main" models and base models from yml files the first time I have to add at the very leased an include for the base model to the "main" model like so:
include_once 'generated/BaseBlog.php';
At the moment before I regenerate the models I move my chang开发者_运维百科ed main models, which is mostly way more then just the include path, in to a tmp folder then I delete all the models. And after regenerating I move my modified models back overwriting the generated main models.
isn't there a way to just create the base models and not touch the main models? Or how do you guys handle this?
Doctrine only overwrites the models in the generated/ folder, it doesn't touch the models that derive from the Base* models.
And if you use conservative loading of models, you don't need to worry about including the base models in your own models at all (and you really should use conservative loading of models).
You can use conservative autoloading like this:
Doctrine_Core::loadModels(APPLICATION_PATH . '/models', Doctrine_Core::MODEL_LOADING_CONSERVATIVE);
It should work with aggressive loading too, but at the moment on some operating systems Doctrine tries to load the child classes before the base classes, and that results in errors.
精彩评论