⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

1-n relation



nerkn
  • profile picture
  • Member

Posted 24 November 2014 - 15:30 PM

hi,

how can I define relation for such a problem:

 

Invoice (id, name) and invoiceLine(id, invoice, name)

 

(I can handle this "office (id, user_id)  users(id, name)" but not above?)

 


Amit Shah
  • profile picture
  • Member

Posted 24 November 2014 - 17:14 PM

please elaborate what exactly you want in here so someone can give u some solution


nerkn
  • profile picture
  • Member

Posted 25 November 2014 - 09:51 AM

invoice (id:333, items:3, total:300,date:'2014-11-24')

  • invoiceLine(id:1501, invoice:333, name:potato, price:100)
  • invoiceLine(id:1502, invoice:333, name:apple , price:150)
  • invoiceLine(id:1503, invoice:333, name:coke  , price:  50)

can you construct relation in grocerycrud?


Amit Shah
  • profile picture
  • Member

Posted 25 November 2014 - 12:25 PM

well.. sorry to stay but still didnt understand ..

as what exactly u wana show and where..

is it in the form ... is it in the listing .. where and what.. ?


cybersven
  • profile picture
  • Member

Posted 03 December 2014 - 08:27 AM

I think what you looking for is :

$crud->set_relation('id','invoice','invoice');

first id from invoice (id:333, items:3, total:300,date:'2014-11-24')

then the table from invoice (id:333, items:3, total:300,date:'2014-11-24')

then the column from invoiceLine(id:1501, invoice:333, name:potato, price:100)