Ver Mensaje Individual
  #2 (permalink)  
Antiguo 01/07/2010, 11:21
Avatar de maycolalvarez
maycolalvarez
Colaborador
 
Fecha de Ingreso: julio-2008
Ubicación: Caracas
Mensajes: 12.120
Antigüedad: 15 años, 9 meses
Puntos: 1532
Respuesta: Ayuda relacion ternaria con Doctrine en Symfony!!!

si posteas un previo del modelo (yml) con las tablas seria más fácil ayudarte e indicarla cardinalidad de cada una con respecto a la otra:

para un blog:
Código YAML:
Ver original
  1. Categoria:
  2.   connection: doctrine
  3.   tableName: blog_categoria
  4.   columns:
  5.     id:
  6.       type: integer(4)
  7.       fixed: false
  8.       unsigned: false
  9.       primary: true
  10.       sequence: blog_categoria_id #postgres
  11.     nombre:
  12.       type: string(50)
  13.       fixed: false
  14.       unsigned: false
  15.       notnull: false
  16.       primary: false
  17.   relations:
  18.     Articulo:
  19.       local: id
  20.       foreign: categoria_id
  21.       type: many
  22.        
  23.      
  24.  
  25. Articulo:
  26.   connection: doctrine
  27.   tableName: blog_articulo
  28.   columns:
  29.     id:
  30.       type: integer(4)
  31.       fixed: false
  32.       unsigned: false
  33.       primary: true
  34.       #postgres
  35.       sequence: blog_articulo_id
  36.     titulo:
  37.       type: string()
  38.       fixed: false
  39.       unsigned: false
  40.       notnull: false
  41.       primary: false
  42.     culturainfo:
  43.       type: string(200)
  44.       fixed: false
  45.       unsigned: false
  46.       notnull: false
  47.       primary: false
  48.     contenido:
  49.       type: string()
  50.       fixed: false
  51.       unsigned: false
  52.       notnull: false
  53.       primary: false
  54.     created_at:
  55.       type: timestamp(25)
  56.       fixed: false
  57.       unsigned: false
  58.       notnull: false
  59.       primary: false
  60.     adicional:
  61.       type: string(20)
  62.       name: adicional as campox
  63.       fixed: false
  64.       unsigned: false
  65.       notnull: false
  66.       primary: false
  67.     categoria_id:
  68.       type: integer(4)
  69.       fixed: false
  70.       unsigned: false
  71.       notnull: true
  72.       primary: false
  73.   relations:
  74.     Comentario:
  75.       local: id
  76.       foreign: articulo_id
  77.       type: many
  78.     Categoria:
  79.       local: categoria_id
  80.       foreign: id
  81.       type: one
  82.  
  83. Comentario:
  84.   connection: doctrine
  85.   tableName: blog_comentario
  86.   columns:
  87.     id:
  88.       type: integer(4)
  89.       fixed: false
  90.       unsigned: false
  91.       primary: true
  92.       sequence: blog_comentario_id
  93.     articulo_id:
  94.       type: integer(4)
  95.       fixed: false
  96.       unsigned: false
  97.       notnull: true
  98.       primary: false
  99.     autor:
  100.       type: string()
  101.       fixed: false
  102.       unsigned: false
  103.       notnull: false
  104.       primary: false
  105.     contenido:
  106.       type: string()
  107.       fixed: false
  108.       unsigned: false
  109.       notnull: false
  110.       primary: false
  111.     created_at:
  112.       type: timestamp(25)
  113.       fixed: false
  114.       unsigned: false
  115.       notnull: false
  116.       primary: false
  117.   relations:
  118.     Articulo:
  119.       local: articulo_id
  120.       foreign: id
  121.       type: one

Última edición por maycolalvarez; 01/07/2010 a las 11:34