V
V
Vladimir2016-09-18 18:21:40
Yii
Vladimir, 2016-09-18 18:21:40

How to intercept data before adding to yii2 database?

Good day! Tell me how you can intercept the data and process it before sending it to the database. For example, I have a couple of checkboxes, their values ​​are id users and I want the values ​​​​to be intercepted after each id, a semicolon is added, but because this data would fly to the database. Thanks in advance for the replies!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-09-18
@MasterGerold

Good evening.
You can use beforeSave(), in this method, process your checkboxes and then write them to the database.
Use implode() to assemble the string.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question