N
N
nepster-web2014-04-01 01:09:22
Yii
nepster-web, 2014-04-01 01:09:22

How to use behaviors in Yii2 to update date?

For example, there is a blog module and we are creating a new post. The entry has a creation date, as I understand it, earlier in Yii1 it was written in afterAction, but now in behaviors, or what?
Can you please tell me how in Yii2 you can add the date of creation or update of a record?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Zelenin, 2014-04-01
@nepster-web

Yii2 has TimestampBehavior. Inside is an example of usage.
https://github.com/yiisoft/yii2/blob/master/framew...

S
Sergey, 2014-04-01
Protko @Fesor

they used to do this in behaviors too, or inside the model itself (with afterConstruct)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question