« Return to Thread: Shared Models in Different Modules

RE: Shared Models in Different Modules

by jwhitcraft :: Rate this Message:

Reply to Author | View in Thread

Correct.
 
I said that wrong.  the news modules only has two modules in it.  One model for the story and one model that contains the actually data of all the stories for the index listing page.
 
Now with that said in my global module folder I have my user model which handles the user info which can be accessed from any controller.
 
 
 
Jon Whitcraft
Indianapolis Motor Speedway
jwhitcraft@...

________________________________

From: Luke Crouch [mailto:luke.crouch@...]
Sent: Sun 12/2/2007 4:14 PM
To: Whitcraft, Jon
Cc: AmirBehzad Eslami; fw-mvc@...
Subject: Re: [fw-mvc] Shared Models in Different Modules


hmm...

you don't mean you want to have *copies* of all the models in each module, right?

you're trying to move ALL models into the news/models directory so the news module is self-contained? to me it only makes sense to put the news-only models into the news module directory. if you have application-wide models, they should stay in the universal models directory, IMO.

-L


On Dec 2, 2007 2:17 PM, Whitcraft, Jon <jwhitcraft@...> wrote:


        Here's how I have my project setup.
       
        application/
          controllers/  <-- default
          layouts/      <-- holds all my main layout pages
          library/        <-- custom library conponents
          models/      <-- where i store all my models currently
          modules/    <-- my different modules
             news/
             photos/
          views/        <-- default views
       
        Under each module I have a controllers, views and models directory.  What I would like to happen is to be able to put each modules models inside of the news/models/ directory instead of the root modelds directroy that way everything is self contained in the directory.
       
        does all that make sense?
       

        Jon Whitcraft
        Indianapolis Motor Speedway
       
        jwhitcraft@...
       
        ________________________________
       
        From: Luke Crouch [mailto:luke.crouch@...]
        Sent: Sun 12/2/2007 2:25 PM
        To: Whitcraft, Jon
        Cc: AmirBehzad Eslami; fw-mvc@...
        Subject: Re: [fw-mvc] Shared Models in Different Modules
       


        our situation might be a bit different, but since there's no real stipulation in Zend_Controller as to where the model classes reside (they're not involved in routing and/or view rendering), I tend to put model classes outside of the ZF app itself - in another dir on my include path.
       
        e.g., assuming a project layout like:
       
        application/
         default/
         module1/
        library/
        document_root/
       
        I would put models under library/ along with Zend/ itself...
       
        library/Zend  # contains ZF
        library/MyProject # namespacing dir for my classes
        library/MyProject/Db # dir for Zend_Db model classes
        library/MyProject/Db/users.php:
        class MyProject_Db_users extends Zend_Db_Table {}
       
        then I can put library/ in my include path, use Zend_Loader autoloading, and use the MyProject_Db_users class from any of the modules under application.
       
        -L
       
       
        On Dec 2, 2007 11:29 AM, Whitcraft, Jon <jwhitcraft@...> wrote:
       
       
               I agree with you. I have having the same problem with my site that you are having.
       
               Jon Whitcraft
               Indianapolis Motor Speedway
       
               ________________________________
       
       
               From: AmirBehzad Eslami [mailto: behzad.eslami@... <mailto:behzad.eslami@...> ]
       
               Sent: Sun 12/2/2007 12:18 PM
               To: fw-mvc@...
               Subject: [fw-mvc] Shared Models in Different Modules
       
       
       
               Hi List,
       
               I asked a question about Shared View Scripts some days ago
               and you recommend me to use Zend_Layout. I have a similiar
               question about Models in a modular-dir-structure.
       
               A website always has a homepage, which usually consists
               of links to other sections (modules). Thus, the default modules
               should have access to other modules' models.
       
               Isn't this an architectural disease? It sounds that these shared
               models are destroying the Modular-based building.
       
               How can I have access to different models in different modules.
               It is critical for default module (homepage) to have access to
               whole website's content.
       
               What is the best place to put centralized code (including
               bootstraper, shared views, shared models?)
       
               ********************
               ********************
               This E-mail (and attachments) may contain confidential/privileged information intended only for the named addressee(s). If you are not an intended recipient, do not read, copy, disseminate or take any action based on the content of this E-mail. Please notify the sender by reply E-mail and erase this E-mail from your system. Your assistance is appreciated. E-mail transmission may not be secure or error-free. The company is not responsible for any loss/damage arising from any virus transmitted.
               ********************
               ********************
       
       
       
       


 « Return to Thread: Shared Models in Different Modules