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

  • Home
  • SEARCH
  • 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 8515541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:10:32+00:00 2026-06-11T05:10:32+00:00

I have two database tables Articles Archive Each article can have multiple records in

  • 0

I have two database tables

  1. Articles
  2. Archive

Each article can have multiple records in Archive table.

This is how Archive entity looks like (shown only needed to understand the question)

/**
 * Archive
 *
 * @ORM\Table(name="archive")
 * @ORM\Entity
 */
class Archive
{

   .....................................................

   /**
     * @var Articles
     *
     * @ORM\ManyToOne(targetEntity="Articles")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="article_id", referencedColumnName="id")
     * })
     */
     private $article;

   .....................................................

   /**
     * Set article
     *
     * @param Articles $article
     * @return Archive
     */
    public function setArticle(\Entities\Articles $article = null)
    {
        $this->article = $article;
        return $this;
    }

    /**
     * Get article
     *
     * @return Articles 
     */
    public function getArticle()
    {
        return $this->article;
    }

    ....................................................
}

In this entity there is a reference to Article entity BUT in Article entity there is no reference to Archive entity.

So the question is – do I need reference to Archive in Article entity and what benefits and downsides it will have?
As I understand having a lot of references is bad (http://docs.doctrine-project.org/en/latest/reference/best-practices.html#constrain-relationships-as-much-as-possible). So where is that point where I can tell do I need it or not?

  • 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-11T05:10:34+00:00Added an answer on June 11, 2026 at 5:10 am

    It’s primarily a decision of architecture and convenience.

    • Does Article need to know about the archived entries?
    • Do I need to access archived entries via an article?

    The first case is mostly just about how you want to represent your data model. Is an article something that should know of its items in archive? Or does only the archive need to know about articles? How is their relation in the data model?

    The second case is more about programming convenience: If you need to often access archived items for an article, it can be more convenient to have $article->getArchives() (or whatever) vs. having to fetch them via a repository or a query. This may go against the data model, so you need to weigh both cases and decide for yourself how to model it and what makes most sense.

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

Sidebar

Related Questions

I have two database tables, grouptypes and groups. A grouptype can have multiple groups,
I have a database two tables and a linking table that I need a
I have two tables in my database schema that represent an entity having a
I have two tables in my database: user and media_contact . The media_contact table
Let's assume I have a database with two tables: categories and articles . Every
I have two tables in my database users table : +-----------+---------------------+---------+---------+ | id |
I have two tables in my database. cat - catid, catname articles - id,
I have two tables from two different databases. For example: Table: Articles1 - Database:
I currently have a database with two tables called Articles and Tags . In
I have two tables in my database articles With the following fields id author

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.