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

The Archive Base Latest Questions

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

I have a site written in cakephp with a mysql database. Into my site

  • 0

I have a site written in cakephp with a mysql database.
Into my site I want to track the activities of every users, for example (like this site) if a user insert a product I want to put this activity into my database.
I have 2 ways:
1) One table called Activities with:
– id
– user_id
– title
– text
– type (the type of activity: comment, post edit)

2) more table differenced by activities
– table activities_comment
– table activities_post
– table activities_badges

The problem is when I go to the page activities of a user I can have different type of activities and I don’t know which of this solution is better because a comment has a title and a comment, a post has only a text, a badge has an external id to its table (for example) ecc…
Help me please

  • 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-07T19:03:51+00:00Added an answer on June 7, 2026 at 7:03 pm

    I’m not familiar with CakePHP, but from purely database perspective your data model should probably look similar to this:

    enter image description here

    The enter image description here symbol denotes category (aka. inheritance, subclass, subtype, generalization hierarchy etc.). Take a look at “Subtype Relationships” in ERwin Methods Guide for more info.

    There are generally 3 strategies for implementing the category:

    1. All types in single table. This requires a lot of NULLs and requires CHECKs to make sure separate subtypes are not inappropriately “intermingled”.
    2. All concrete types in separate tables (excluding the base, which is ACTIVITY in your case), which means common fields and relationships must be repeated in all child tables.
    3. All types in separate tables (including the base). This implementation requires a little more JOINing, but is flexible and clean. It should be your default, unless there are strong reasons against it.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written this regexp: <(a*)\b[^>]*>.*?</\1> and is tested on this regexp testing site:
This is the script I have written for gzipping content on my site, which
I have this site, written in php, and when the content is large enough
I have already a web site written in Html but I want to add
I have written a site in Prototype but want to switch to jQuery. Any
I have a web site (written in PHP) that my users need to log
I have a site written in Delphi that needs to get data from a
Let us suppose we have a site entirely written on Silverlight. All navigation occurs
I have an English language forum site written in perl that is continually bombarded
I have a site where people post news, it is written in PHP. Up

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.