Hello I would like to share with you 2 issues I have.
Here is the big picture <https://lh3.googleusercontent.com/-bok52dWLfzk/VUj205XrXAI/AAAAAAAABkc/i8dc5vUs7KM/s1600/design.png> Basically I'm trying to create an architecture (inheritance and associations) of entities using a single table : CREATE TABLE `outcome` ( `id` int(11) NOT NULL AUTO_INCREMENT, `object` enum('event','tournament_stage','tournament','tournament_template','standing','sport') CHARACTER SET latin1 NOT NULL, `objectFK` int(10) UNSIGNED NOT NULL, `type` enum('1x2','12','ou','ah','oe','cs','win','1x2_hc','dc','gs','ht_ft','ng','smg','nc','tng','dnb','bts','wtn','c_ah','ew') NOT NULL DEFAULT '1x2', `event_participant_number` int(11) NOT NULL COMMENT 'To be deprecated', `scope` enum('ord','ot','fe','1h','2h','1p','2p','3p','1q','2q','3q','4q','1s','2s','3s','4s','5s','1r','2r','3r','4r','5r','6r','f5i') NOT NULL, `subtype` enum('win','draw','over','under','score','odd','even','win_draw','next','anytime','last','from','from_to','to','yes','no','place','none','other') NOT NULL, `iparam` int(11) NOT NULL, `iparam2` int(11) NOT NULL, `dparam` double NOT NULL DEFAULT '0', `dparam2` double NOT NULL DEFAULT '0', `sparam` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `del` enum('no','yes') NOT NULL DEFAULT 'no', `n` int(10) UNSIGNED NOT NULL, `ut` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `obj_fk_type` (`object`,`objectFK`,`type`), KEY `ut` (`ut`)) ENGINE=InnoDB AUTO_INCREMENT=16933691 DEFAULT CHARSET=utf8; More details here : http://wiki.spocosy.enetpulse.com/doku.php?id=wiki:spocosyodds:xmldoc Here is the current mapping : Acme\DemoBundle\Entity\Competition: type: entity id: id: type: integer generator: strategy: AUTO options: unsigned: true fields: name: type: string length: 50 nullable: false Acme\DemoBundle\Entity\CompetitionOutcome: type: entity manyToOne: competition: targetEntity: Acme\DemoBundle\Entity\Competition joinColumns: objectFK: referencedColumnName: id nullable: false Acme\DemoBundle\Entity\Match: type: entity table: `Match` id: id: type: integer generator: strategy: AUTO options: unsigned: true Acme\DemoBundle\Entity\OddEvenMatchOutcome: type: entity Acme\DemoBundle\Entity\Outcome: type: entity inheritanceType: SINGLE_TABLE table: Outcome id: id: type: integer length: 10 generator: strategy: AUTO options: unsigned: true fields: status: type: string length: 20 nullable: true column: status options: default: NULL del: type: string length: 3 nullable: false column: del options: default: no createdAt: type: datetime nullable: true column: createdAt options: default: NULL updatedAt: type: datetime nullable: true column: updatedAt options: default: NULL manyToOne: type: targetEntity: Acme\DemoBundle\Entity\OutcomeType joinColumns: type: referencedColumnName: id nullable: false discriminatorColumn: name: type type: integer discriminatorMap: 2: Acme\DemoBundle\Entity\ThreeWayMatchOutcome 3: Acme\DemoBundle\Entity\OddEvenMatchOutcome 1: Acme\DemoBundle\Entity\CompetitionOutcome Acme\DemoBundle\Entity\OutcomeType: type: entity id: id: type: integer generator: strategy: AUTO fields: code: type: string unique: true length: 30 nullable: false manyToOne: category: targetEntity: Acme\DemoBundle\Entity\OutcomeTypeCategory joinColumns: category: referencedColumnName: id nullable: false Acme\DemoBundle\Entity\OutcomeTypeCategory: type: entity id: id: type: integer generator: strategy: AUTO options: unsigned: true fields: code: type: string unique: true length: 30 nullable: false Acme\DemoBundle\Entity\Participant: type: entity id: id: type: integer generator: strategy: AUTO options: unsigned: true fields: name: type: string length: 50 nullable: false Acme\DemoBundle\Entity\ThreeWayMatchOutcome: type: entity manyToOne: homeParticipant: targetEntity: Acme\DemoBundle\Entity\Participant joinColumns: iparam: referencedColumnName: id awayParticipant: targetEntity: Acme\DemoBundle\Entity\Participant joinColumns: iparam2: referencedColumnName: id Now I'm facing 2 issues : 1. Outcome#type can not be both a many-to-one owner side and a discriminator. Then I can not use Outcome#type in QueryBuilder to filter Outcome based on OutcomeType#category 2. Can not have a "multi level" inheritance such as Outcome > MatchOutcome > ThreeWayMatchOutcome. So I would need common properties of a MatchOutcome into ThreeWayMatchOutcome and OddEvenMatchOutcome Some datas so everything make sens : OutcomeType id | code | category 1 | match/three_way/home | 1 2 | match/three_way/draw | 1 3 | match/three_way/away | 1 4 | match/odd_even/odd | 2 5 | match/odd_even/even | 2 OutcomeTypeCategory id | code 1 | match/three_way 2 | match/odd_even All feedbacks are welcome Cheers -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
