» DataBase Data interity with four tables
DataBase Data interity with four tables
|June 27, 2014
Posted by forumadmin
I have four tables (products, brands, colors and colorproducts)
– a product has one brand
– a color has one brand
– a colorproduct has one product and one color
The problem I see is that a colorproduct references a color and a product and that both of them reference a brand.
What happens if a product and a color referenced by the same colorproduct reference 2 different brands?
I suppose my database is bad but I don’t know how to fix it.
I use Doctrine 2 ORM and I have read in their documentation that the use of composite primary keys should be avoided if possible. Would you see a solution to my problem?
More Related Questions
- Doctrine 2 mapping referencing unique key Basic question:
Is it possible to map an association using Doctrine referencing not a primary but only a unique key?
I have an Entity (Participation) which may […]
- Doctrine many to one relationship persist operation I have a story table and user table.The column userid in story table is a foreign key which refers the id in user table.I have set the relationship is that a user may have many stories […]
- Accessing Elements In Doctrine Query Not Working I have a Doctrine query, where the "JOIN p.product pr" is joining in the Product Table and all of its info (id, name, qty, status, created, updated, deletedAt, etc...)
Custom function […]
- Symfony2 custom doctrine request I'm still having a problem which let me stop on working because I don't get it solved.
I have 2 tables , Task and TaskDone.
In Task there is stored the ID of the Task ( ID ) and the […]
- Doctrine and DateTime showing wrong difference I can't wrap my head around an issue with DateTime(). I want the difference between some saved time in the database and now. It works on my local machine but not on the live server.
- Doctrine2 and MySQL Partitioning Does anybody has experience of using partitioning feature in conjunction with the Doctrine2 library?
The first problem is that Doctrine creates foreign keys for association columns, […]
- Increasing mysql connections We got a big problem with our mysql server setup. We use Zend Framework 2 with Doctrine 2 and PDO Mysql connection.
Our problem is, that the connections shown with mysql > show status are […]
- Doctrine Order by id=1 I want get list users and current user must be first every-time.
In MySql i can make as:
SELECT * FROM `user` ORDER BY id = 2 DESC
In Doctrine i try make alike:
$query = […]
- Symfony 2 object with array of objects, how to access them? I have 3 Symfony2 entities that are related in the following way:
A Vehicle with Plate Number, make, model. Also the vehicle has many Jobs and Fuel Purchases
Job has a method that gives […]
- Doctrine WHERE IN Problems Before I begin, I believe I have tried everything from this previous post: How to use WHERE IN with Doctrine 2
So I have a Silex application connected to a MySQL DB using Doctrine via […]