Chris

I use modules as a way of separating out functionality, such as /default and 
/manage.  All of my models are in a /models folder at the /application level 
(alongside /modules).  I do this because of the following:  in a site where you 
have/need an administration section, most if not all of the dynamic content and 
functionality on the front-end will be represented in the back-end.  Let's say 
you have a Products model.  You may have a method to retrieve all the products, 
view the images larger, etc.  You can still use the retrieve all products 
method in the back-end in order to list products to select for editing, etc.  
There will be more methods in your model than your front-end uses, but most of 
the ones the front-end uses can be used by the backend.

Hope this helps you along your path as well.


----
Jeremy Brown
Senior Web Developer
Spear One
972.661.6038
www.spearone.com

-----Original Message-----
From: chrisweb [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 23, 2008 5:59 AM
To: fw-general@lists.zend.com
Subject: Re: [fw-general] multiple models with same name (m1/models/pages.php 
and m2/models/pages.php)


Hello,

Thx for telling me your thoughts, its good to have different opinions about
how to solve that problem, i still don't know what way is best, but as you
said i think it depends on what you want to achieve ...

the idea of having a folder for models where you put all your models is a
good one, but i for example wanted to seperate delete-stuff-methods in admin
from output-stuff-methods in front ...

the idea of using modules is also a good one, but then you have the problem
that you must use different names for your models or just load the model you
need.

Of course there are some more things to consider ... i will try to download
applications created with zend framework to see what kind of solution they
choose and try to understand why a solution is perhaps better then another
one.

thx for your help

Chris



DASPRiD wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Your last statement is not completly correct, Bill. The sence behind
> modules is, to logically seperate your code. As in your example, an
> admin interface and the frontend for the user.
>
> Bill Karwin schrieb:
>>
>>
>> Edward Haber wrote:
>>> Another problem with the proposed solution is that it only makes one
>>> module's models path active at a time. I think the ideal when working
>>> with multiple modules is to have the option of using model code from
>>> more than one module models directory at a time, especially in cases
>>> of interdependency.
>>>
>>
>> No, that's not ideal, that's actually what I was recommending to
>> _prevent_.
>>
>> A module has its own controllers and views, and should have its own set
>> of
>> models as well.  One module should not be allowed to reference another
>> module's controllers, views, or models.  If you follow this rule, then it
>> solves all the problems of ambiguity and collision.
>>
>> Don't separate your application into modules if the modules aren't
>> separate.
>> If you want to share model classes among all your controllers, then don't
>> create modules.
>>
>>
>> Edward Haber wrote:
>>> If however it is a must that you remain encapsulation and that these
>>> modules are dropped into other apps and need to work this way, then I
>>> would change the names of your models entirely.
>>>
>>
>> This doesn't work in general, if you drop third-party modules into your
>> app,
>> or drop your module into someone else's app.  Only if you have control
>> over
>> the class naming of all modules in an app does your recommendation work.
>> If
>> you're the author of all the modules in the app, then why are you using
>> modules at all?
>>
>> The purpose of modules is to provide isolation between sets of classes.
>> Many people seem to use modules to create friendly URL's like
>> "/myapp/admin/controller/action" but you can do this by creating custom
>> router rules.  You don't have to use modules simply to define URL's.
>>
>> Regards,
>> Bill Karwin
>
> - --
> ...................................
> :  ___   _   ___ ___ ___ _ ___    :
> : |   \ /_\ / __| _ \ _ (_)   \   :
> : | |) / _ \\__ \  _/   / | |) |  :
> : |___/_/:\_\___/_| |_|_\_|___/   :
> :........:........................:
> : Web    : http://www.dasprids.de :
> : E-mail : [EMAIL PROTECTED]       :
> : Jabber : [EMAIL PROTECTED]     :
> : ICQ    : 105677955              :
> :........:........................:
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFI2D1O0HfT5Ws789ARAhn0AJ4j6ozeUnA1D77gyiJEUAuAQ8fP/gCgoIcH
> tIjgzWA/JRe1HGb9XBqztFs=
> =1qnX
> -----END PGP SIGNATURE-----
>
>

--
View this message in context: 
http://www.nabble.com/multiple-models-with-same-name-%28m1-models-pages.php-and-m2-models-pages.php%29-tp19607614p19625354.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to