Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8693381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:32:00+00:00 2026-06-13T00:32:00+00:00

To make my doubt clear, I have this scenario: I have an app that

  • 0

To make my doubt clear, I have this scenario:

I have an app that sells cars and houses (just an example!), so I created a module to show all the cars, called Cars, and one to show all the houses, called Houses.

I have a Manager module that should have a CRUD system for Cars and Houses.

Where should I put my models for cars and houses? I should create a module just to put my models, like a Main module? Or I should put my models in Cars and Houses modules and access them in Manager module?

Let’s say I create a CarModel with the methods select, insert and delete. If I put this model in Cars module I can have a security problem because Cars now have access to insert and delete methods…

On the other hand, I could create a CarModel inside Carsmodule with only the select method and then create again a CarModel with insert and delete in Managermodule, but It will make very difficult to maintenance of the code…

What’s the best way to solve this issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:32:01+00:00Added an answer on June 13, 2026 at 12:32 am

    So to answer your question at a high level, there’s really two ways you can go about breaking up your modules in the context you’ve given:

    • All-in-one module (combine admin/CRUD with the actual module providing the entities and front-end stuff). One of my devs has taken this approach with this module: https://github.com/speckcommerce/SpeckCatalog
    • Separate modules. For example, ZfcUser provides no user administration, but ZfcUserAdmin makes use of the entities / mappers in ZfcUser and provides additional user management / admin functionality.

    Neither approach is wrong or right. It really just depends on your preference and how you want to break down the functionality of your application. E.g., Will you ever want to build a site that would use the Houses or Car module without the management / CRUD system?

    On a more technical level, there’s several ways you can handle “models” or “entities” using Zend\Db. Two common patterns are the TableGateway pattern and the Data Mapper pattern.

    • Table Gateway: I’ve blogged about this one: http://blog.evan.pro/zf2-tablegateway-hydration

    • Data Mapper: This is my preferred solution. I haven’t blogged about this one yet, but you can find a usage example in ZfcUser. Also, a base data mapper is not built into ZF2 like the Table Gatway is, but it’s a much more flexible solution. Check out the AbstractDbMapper provided by ZfcBase.

    I’ll take this opportunity to tease a couple of slides from the ZF2 tutorial that Rob Allen and I gave at PHPNW12 and will also be giving again at ZendCon in a couple of weeks:

    Table Gateway http://evan.pro/caps/2ddbaf.png
    Table Gateway Select http://evan.pro/caps/0904b8.png
    AbstractDbMapper http://evan.pro/caps/a31480.png
    Mapper Select http://evan.pro/caps/a2a04f.png
    Summary http://evan.pro/caps/3ec9e6.png

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I make an app that have to printing image. I need to print image
Doubt this is possible as I don't have a 1 page app, but pretty
I need some help! I have no doubt this is a dumb problem that
I know this is a silly doubt but I just want to make sure
i make one class file for jar. and this class have use wurfl. and
I want to make 3d games for the iphone and with all this doubt
i want to make a application using silverlight.i want to know that is this
Is that even possible? I doubt it, but want to make sure.
I have a doubt and I still searching how I could do this. Can
I have this doubt for a long time... hope anyone can enlight me. Suppose

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.