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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:44:40+00:00 2026-05-18T09:44:40+00:00

In my database I have a table ‘favorites’ and a table ‘activity’. I am

  • 0

In my database I have a table ‘favorites’ and a table ‘activity’. I am using the Zend Framework and I have a class modeling both tables. Now, when someone favorites an article then I have to add a row in the activity table.

The most obvious way to do this would be to create the methods addActivity and addFavorite in the respective table classes, and whenever an article is favorited I would call then addActivity method. Although this is very straightforward, it doesn’t seem natural to me.

Do you have any suggestions on a better way to do this?

  • 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-05-18T09:44:41+00:00Added an answer on May 18, 2026 at 9:44 am

    I had faced the same problem in the past. I had it solved, using your ontology, with a static method in the activity table the call was something like:

    Activity::addNew($favouriteID, Activity::FAVOURITE);
    

    and yes it looks un-natural.
    You are talking about Aspect Orientation here, I’m afraid…

    Another way to do it (but did not choose it for other reasons), would be by adding a trigger to the database, which would populate
    activity, each time a favourite was added. I did not want to go there because it is overstated in the literature that triggers soon
    get out of control. This depends on how much application logic you want to have on database level…

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

Sidebar

Related Questions

I have Database table and I am using SQL Server 2008. The table contins
My database table have a Timestamp column and i am using LINQ for insert,
I want to read database tables with Attributes. I have Table in database and
I am using MySQL and PHP . In my database I have this table
My database table have a Timestamp column named as inTime and i am using
In my database I have table AnimalDetails containing animalNumber(primary key),name,breed dateofbirth and an image
i have database table like this +-------+--------------+----------+ | id | ip | date |
I have a table Person which contains 2 fields.In my another database i have
that my problem: I have database table like that: id (AI) market_id 1 6
i have a database table of website links. i have another table of tags,

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.