⚠ 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

Setting N:1 relation



cchronius

cchronius
  • profile picture
  • Member

Posted 27 September 2017 - 19:23 PM

Hello,
 
I started using the tool a short time ago and I'm doubtful about the best way to implement a CRUD for the database model presented in Figure 1.
 
The database model is in the figure 1. I was able to make CRUD for the SM_ESTABLISHMENTS table and the N: N relationship SM_ESTABLISHMENT_CATEGORIES. The result is in Figure 2. The problem arose when I was trying to make the relations n: 1. Each SM_ESTABLISHMENT can have n phones and n emails. I could not think of a simple way to implement this using GroceryCrud. Any suggestion on how to implement this in Grocery?

 

 

[attachment=1240:database.png]

 

[attachment=1241:interface.png]

 

 

Thanks


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 29 September 2017 - 04:39 AM

Well my friend - technically that aint much of an option available but what you can do is a workaround on the same, a simpler solution - that we used to have it in past - a simple textarea for both (of course this are extra fields that need to be handled using callbacks). Having a line seperated values that were handled @ the time of inserts / updates with callback.

 

Now u can have your own callback for insert / update or u can handle the insertion of those values post insert / update.

 

Hope this will help you solve your issue. Happy GCing :)