http://fedecarg.com/wiki/Module-specific_Models
Marian Meres wrote:
>
> Hello Graham,
>
> okay, I see what do you mean. Makes sense.
>
> Just quickly looking at Matthew's formLoader example
> (http://tinyurl.com/6xglab) makes me think that with small adjustment it
> should work for cross module form loading as well (e.g.: just add 3rd
> parameter $module):
>
> function loadForm($name, $options = null, $module = null)
> {
> $module = $module ? $module : $this->getRequest()->getModuleName();
> ...
>
> Regards,
> Marian
>
>> To re-use this module, I have three locations to add to my
>> archive/package.
>> Also I can't easily share this module, how can I guarantee that the next
>> developer who wants to use this module has the same layout structure?
>> Does he
>> use the same loader code? does he use Zend_Loader and autoload? Does he
>> have
>> SomeForm.php already in his own library?
>>
>> Not to mention tracking versions of these files in three locations,
>> across
>> multiple apps.
>>
>> If I store my models within my module directory, and also any forms I
>> need for
>> this module. I can easily use svn externals for each module i want to
>> share or
>> a tarball of the module directory or whatever.
>>
>>> Include path is set first for application and secondly for repository.
>>
>> What if I want to share my module ( and by inheritance my model and form
>> code
>> within the module ) with someone on shared hosting who has no access to
>> modify
>> the Include path?
>>
>>> Does this not answer the sharing problem?
>>
>> In so far as some developers may never have to worry about sharing
>> modules, or
>> may not have a requirement to do so. A loader helper will not only allow
>> models to be stored and shared from within a module directory ( the same
>> as if
>> the models were in "application/models" or "application/library/Domain/"
>> ) but
>> will make sharing and re-use of modules easier.
>>
>> Basically, I do this already myself, but I've seen a few enquiries
>> recently
>> about re-using modules, models and so on. I think it's of value to make
>> steps
>> to facilitate more sharing of code, and from my point of view there's are
>> benefits for having your application/modules structured in this way.
>>
>> If enough people think it's of benefit, great I'll author the proposal,
>> if not
>> _shrug_ it's a fairly simple helper and not a lot of code anyay ;)
>>
>> Cheers the noo
>> Graham
>>
>
>
>
--
View this message in context: http://www.nabble.com/Code-re-use-across-modules-tp19103880p19127298.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论