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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:07:07+00:00 2026-06-07T06:07:07+00:00

I am writing a Data Mapper in PHP and am trying to work out

  • 0

I am writing a Data Mapper in PHP and am trying to work out how to implement an Identity Map when my domain objects follow Class Table Inheritance.

The problem, as I see it, is that an Identity Map cannot guarantee that data is manifested only once in the in-memory model because hierarchical objects are relying on hierarchical data.

For example, in my database I have a Parent table and a Child table. In my domain model I have a Parent class, and extending from that, a Child class. I can instantiate both a Parent object and a Child object, and record their identities in an Identity Map, no problems. If client code requests the same Parent or Child, I can return it from my cache, rather that the database, no problems.

But what happens if the Parent and the Child both relate to the same parent record? i.e. the same data in the Parent table? I now have that data represented twice in-memory, and if it’s modified in one (or both instances) I risk overwriting the changes.

It seems to me that somehow the Identity Map needs to follow a hierarchy similar to the Domain Objects and Mappers themselves, however it gets a bit complex at that point. Also, I have lots of Dependent Mappings to take into account too.

Any ideas/advice much appreciated!

  • 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-07T06:07:09+00:00Added an answer on June 7, 2026 at 6:07 am

    I defined an interface, iQueueable, and only objects which implement this interface may be queued to have their changes written to the database.

    Child objects have the full complement of object properties, so they implement iQueueable. Parent objects can not be queued.

    This still allows parent and child object to fall out of synchronisation, but now there is only one source of database changes.

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

Sidebar

Related Questions

I'm trying to find out if there is a shorter way of writing data
I am trying to find out where does the output of a Map task
I am writing data synchronization application between sql server and firebird. In firebird is
I am writing data in a file. The file will look like this. [section1]
My application is SL2 reading and writing data through an Entity Framework Model exposed
I am writing a Silverlight application that will be both reading and writing data
To start I am coding in C#. I am writing data of varying sizes
i'm writing a data migration using south... but the question refers to the use
Hello I am writing some data structures in C, and I've realized that their
I'm writing a data access layer. It will have C# 2 and C# 3

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.