⚠ 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

Doubts on set_model



Qarlo
  • profile picture
  • Member

Posted 14 February 2012 - 15:55 PM

Hi,
looking at the documentation page for the set_model function I'm not sure how to use it.

In the example I see that inside the model you define a function named [font=monospace]"[/font]get_relation_n_n_unselected_array". I don't get how to use this function. It doesn't seem that you calling it anywhere in the controller. Instead in the controller there is this: [color=#000088]$crud[/color][color=#339933]->[/color][color=#004000]set_relation_n_n[/color][color=#009900]([/color][color=#0000ff]'actors'[/color][color=#339933],[/color] [color=#0000ff]'film_actor'[/color][color=#339933],[/color] [color=#0000ff]'actor'[/color][color=#339933],[/color] [color=#0000ff]'film_id'[/color][color=#339933],[/color] [color=#0000ff]'actor_id'[/color][color=#339933],[/color] [color=#0000ff]'fullname'[/color][color=#339933],[/color][color=#0000ff]'priority'[/color][color=#009900])[/color][color=#339933];[/color]

It's just an error or are you using some specific names?
Can you give some more explanations about this?

Thanks

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 16 February 2012 - 22:16 PM

The set_model is called from the core library. You can also see another example of using set_model at: /topic/90-how-to-create-an-extension-for-grocery-crud-real-example-included/ . The set_model is good to use it when you have enough experience with grocery CRUD and you really need something custom that grocery CRUD doesn't have.