質問

I have an application where I use Codeigniter + Grocery CRUD.

I was making a "n_n" relation , but in table that store the relation there is a third field.

Bellow my DB structure:

enter image description here

Grocery CRUD allows me to select the socialmedia as displayed bellow:

enter image description here

The complete functionality is showed here: http://www.grocerycrud.com/documentation/options_functions/set_relation_n_n

How can I complete the profile field (commerce_socialmedia.profile) when a socialmedia item is selected in my form? Someone can help me? Is there something already done for my necessity?

Thanks

役に立ちましたか?

解決

i just create a Pull Request with this feature.

In order to use the extra fields functinality you need to pass one extra parameter to the set_relation_n_n function indicating that you want to edit the extra fields

$crud->set_relation_n_n('secialmedia', 'ecommerce_socialmedia', 'socialmedia', 'id', 'id_socialmedia', 'name', null, null, true);

You can also indicate that you don't want to edit one of the extra fields of the relation table by using the unset_edit_fields. You will however be required to prepend the name of the field you wish to exclude, with the string extra_field in order to avoid name conflicts

$crud->unset_edit_fields(array('extra_field_{relation_table_field_name}'));

Follow the link

https://github.com/scoumbourdis/grocery-crud/pull/275

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top