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 8966293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:59:42+00:00 2026-06-15T16:59:42+00:00

I have question about how to correctly write my application. I would like to

  • 0

I have question about how to “correctly” write my application.

I would like to follow the service/DAO/mapper/entity model and I think that I fully understand it but I found out that some things which I want to do might collide with general conception of this model.

I have these database tables:
Product table and it's related table - manufacturers

I have simple ProductDbMapper which gets product’s data from database and returns them as a Product entity so I can use it like this:

echo $productEntity->getName();
$productEntity->setPrice(29.9);

I think that it would be great to be able to use somethink like this:

echo $productEntity->getManufacturer()->getName();

The “getManufacturer()” method would simply query another service/DAO for the manufacturer by id. I know that the correct way how to get manufacturer of a product is:

$product = $productService->getProduct(5);
$manufacturer = $manufacturerService->getManufacturerByProduct($product);

But I think that “the fluent” solution is much simplier – it’s easy to understand and fun to use. Actually it’s pretty natural. I tried to implement this by callbacks. I passed the callback which calls manufacturer’s service to Product entity in my ProductMapper.

Problem is that it looks like I’m trying to follow the 5 layer model and at the same time I’m trying to avoid it. So my question is: does this look like a good solution? Does it make sense? How could I achieve the same (magic) in better way?

  • 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-15T16:59:42+00:00Added an answer on June 15, 2026 at 4:59 pm

    I’ve been doing some research for couple of days and I came to conclusion that the best way to achieve what I want is to stop trying to code it myself and just learn to use existing ORM. Because everything what I’ve been trying to do was creating of my own ORM. And I know that this is bad idea. I will stick with Doctrine 2.

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

Sidebar

Related Questions

I have been asked to post a new question about how to correctly sort
I have question about parsing in Html helper : I have sth like: @foreach
I have a question about solving UI freezing. Introduction: I am currently programming an
I have a question about list in tcl, what is the correct way to
I'm currently using JavaScript (CommonJS) in Titanium Studio and have a question about prototyping.
I'm currently developing some things in Python and I have a question about variables
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass
I have a question about outputting PDF files. Currently I'm storing the PDF in
Good afternoon, i write in order to ask a question about the use of
hello I have some question about writing class in Java, why this one is

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.