Y
Y
yativ_sobb2016-04-01 21:44:26
Yii
yativ_sobb, 2016-04-01 21:44:26

How to add a record to 2 tables in yii2?

I created with gii table models.
1 table
id_shop
id_shop_value
id_shop_categor
2 table
id_shop_value
value
link It is
necessary that they are both filled when adding
value=
id_shop_value values ​​but that auto-increment
and 2 table
id_shop_value=id_shop_value (from the first table)
id_shop but that auto-increment

Answer the question

In order to leave comments, you need to log in

2 answer(s)
3
333Serega333 333Serega333, 2016-04-01
@333Serega333

Execute an INSERT query and write to at least 2, at least 5 tables.
PS The question could have been more detailed.

M
Maxim Timofeev, 2016-04-03
@webinar

You create a model without a table, just for the form (like the standard ContactForm). In it, you create a save or saveAll () method and describe the save as you need in it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question