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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:29:35+00:00 2026-05-17T22:29:35+00:00

Say I have a system with Products that can have various decoration (or printing)

  • 0

Say I have a system with Products that can have various decoration (or printing) options.

Most products will have a similar range of printing options names, but some maybe unique for a single product.

For example, I could have a cap that could have three different decoration options:

  1. Unbranded
  2. One Color Print
  3. Embroidery

My goal is trying to minimize decoration option names created by admin users so they are always the same. I.E. I don’t want some decoration options being called “1 Color Print” and then another one called “One Color Print”.

So my plan is in the UI is to have a drop down of existing decoration options names but also give them the option to add a new one (for the edge cases).

However, each decoration option has various other data with it, like setup cost, production time, etc which varies depending on the product.

For example, Hat1 and Hat2 could both have an embroidery decoration option, but Hat1’s setup cost is $49 and Hat2’s setup cost is only $35.

So my questions is, what is the best way to structure my entities? Should I have three entities: Product, DecorationOption and DecorationOptionName? Or just two entities: Product and DecorationOption?

Please see my code examples for further understand:

  1. Three entities option
  2. Two entities option
  • 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-17T22:29:35+00:00Added an answer on May 17, 2026 at 10:29 pm

    I would use the three entity approach, with some minor differences in semantics: Product, Decoration, and ProductDecoration. It’s essentially the idea behind a many-to-many join table, but you treat the join as it’s own object, where you can store extra information.

    Products and Decoration are their own separate entities, and information about the relationship between any given Product and any given DecorationOption is managed in ProductDecoration. You can achieve this using two OneToMany relationships.

    <?php
    
    class Product 
    {   
        /** @OneToMany(targetEntity="ProductDecoration", mappedBy="product") */
        private $productDecorations;
    
    }
    
    
    class Decoration
    {   
       /** @Column(type="string") */
       private $name;   
    
       /** @OneToMany(targetEntity="ProductDecoration", mappedBy="decoration") */
       private $productDecorations;
    }
    
    class ProductDecorations
    {   
    
       /** @ManyToOne(targetEntity="Product", inversedBy="productDecorations") */
       private $product;
    
       /** @ManyToOne(targetEntity="Decoration", inversedBy="productDecorations") */
       private $decoration;
    
       /** @Column(type="integer") */
       private $setupCost;
    
       /** @Column(type="integer") */
       private $productionTime
    }
    

    The only way I’d recommend using the two Entity approach is if you can anticipate never needing more than the ‘name’ column for the Decoration entity, and you’re not bothered by potential database normalization issues.

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

Sidebar

Related Questions

Can the calendar control be customsised so that, say you have a system of
Lets say that I have two strings: The System is in halt state. The
First of all, I have to say that I'm going to talk about System.ComponentModel.Component
Let's say I have some system that coordinates the transfer of many files; that
Let's say we have system A comprising a MySQL database, with several tables. After
Say I have a couple of java runtime environments running on my system which
Say I have a simple object which supports implicit casting to System.String public sealed
Lets say we have a derivided class SerializableLabel from the base class System.Windows.Controls. [XmlRoot(SerializableLabel)]
Lets say we have two objects o1 & o2 defined as System.Object, in my
I have a control ...any System.Windows.Forms.Control . say for eg. label. I wish to

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.